Created
September 17, 2017 23:06
-
-
Save kiramishima/276512cd0d6769851e50cbb0d721f0d2 to your computer and use it in GitHub Desktop.
Sample Bot Reservation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bot = new builder.UniversalBot(connector, [ | |
function (session) { | |
session.send("Welcome to the dinner reservation."); | |
builder.Prompts.time(session, "Please provide a reservation date and time (e.g.: June 6th at 5pm)"); | |
}, | |
function (session, results) { | |
session.dialogData.reservationDate = builder.EntityRecognizer.resolveTime([results.response]); | |
builder.Prompts.number(session, "How many people are in your party?"); | |
}, | |
function (session, results) { | |
session.dialogData.partySize = results.response; | |
builder.Prompts.text(session, "Whose name will this reservation be under?"); | |
}, | |
function (session, results) { | |
session.dialogData.reservationName = results.response; | |
// Process request and display reservation details | |
session.send(`Reservation confirmed. Reservation details: <br/>Date/Time: ${session.dialogData.reservationDate} <br/>Party size: ${session.dialogData.partySize} <br/>Reservation name: ${session.dialogData.reservationName}`); | |
session.endDialog(); | |
} | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment