-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot_ui.js
39 lines (36 loc) · 1.09 KB
/
bot_ui.js
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
<div class="chat__intro__scroll botui-app-container overflow-auto" id="botui-app" ">
<bot-ui>
</bot-ui>
Scroll, if you don't feel like talking ⇣
</div>
<script type="text/javascript">
var botui = new BotUI('botui-app') // id of container
botui.message.bot({ // show first message
delay: 3000,
content: 'hey there, hope you are having a good day.'
}).then(() => {
return botui.message.bot({ // second one
delay: 2000, // wait 1 sec.
content: 'I’m a Banglore based Networks Engineer. I like to code and hack stuff :P Would you like to know more about me or skip to next'
})
}).then(() => {
return botui.action.button({ // let the user perform an action
delay: 1000,
action: [
{
text: 'More',
value: 'more'
},
{
text: 'Skip',
value: 'skip'
}
]
})
}).then(res => {
return botui.message.bot({
delay: 1000,
content: `it's a ${res.text}!`
})
})
</script>