Skip to content

Instantly share code, notes, and snippets.

@kiramishima
Created September 17, 2017 23:06
Show Gist options
  • Save kiramishima/276512cd0d6769851e50cbb0d721f0d2 to your computer and use it in GitHub Desktop.
Save kiramishima/276512cd0d6769851e50cbb0d721f0d2 to your computer and use it in GitHub Desktop.
Sample Bot Reservation
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