-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbot-script.js
More file actions
57 lines (54 loc) · 1.15 KB
/
bot-script.js
File metadata and controls
57 lines (54 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
var botui = new BotUI('help-bot');
botui.message.add({
delay: 500,
loading: true,
content: 'Hi! Welcome to my website'
}).then(function () {
return botui.message.add({
delay: 500,
loading: true,
content: 'How can I help?'
});
}).then(function () {
return botui.action.button({
action: [
{
text: 'What are your opening hours?',
value: 'hours'
},
{
text: 'What do you do?',
value: 'do'
}
]
});
}).then(function (res) {
var message;
if (res.value === "hours") {
message = 'That’s a good one! This is a website, it’s always open.';
}
else if (res.value === "do") {
message = 'I’m a product-focused Scrum master<br><br>I also have a keen interest in chatbots and web analytics';
}
return botui.message.add({
type: 'html',
delay: 1000,
loading: true,
content: message
});
}).then(function (index) {
return botui.action.button({
action: [
{
text: 'Cool!',
value: 'cool'
}
]
});
}).then(function (index) {
return botui.message.add({
delay: 1000,
loading: true,
content: 'I know! Thanks.'
});
});