-
Notifications
You must be signed in to change notification settings - Fork 5
/
sample-defaultDialog.js
26 lines (22 loc) · 982 Bytes
/
sample-defaultDialog.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
const builder = require('botbuilder');
const connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
const bot = new builder.UniversalBot(connector, [
(session, args, next) => {
const card = new builder.ThumbnailCard(session);
card.buttons([
new builder.CardAction(session).title('Add a number').value('Add').type('imBack'),
new builder.CardAction(session).title('Get help').value('Help').type('imBack'),
]).text(`What would you like to do?`);
const message = new builder.Message(session);
message.addAttachment(card);
session.send(`Hi there! I'm the calculator bot! I can add numbers for you.`);
const choices = ['Add', 'Help'];
builder.Prompts.choice(session, message, choices);
},
(session, results, next) => {
session.endConversation(`You chose ${results.response.entity}`);
},
]);