jazzedge
7/28/2017 - 11:30 AM

Bot - Root Dialog variations

Bot - Root Dialog variations

// 01. Root Dialog
var bot = new builder.UniversalBot(connector, 
    function (session) {
      // echo the user's message
      session.send("You said: %s", session.message.text);
   }
);

// 01. Root Dialog 
var bot = new builder.UniversalBot(connector, [
    (session, args, next) => {...},
    (session, results, next) =>{...}
]);


// 01. Root Dialog

var bot = new builder.UniversalBot(connector);  

bot.dialog('/', function (session) {
    session.send('Hello World');
});	


// 01. Root Dialog

var bot = new builder.UniversalBot(connector);

bot.dialog('/', [
    function( session ) {
        builder.Prompts.text(session, "blah blah blah?");
    },
    function( session, results ) {
        // ...

        session.beginDialog('/foo');
        session.endDialog();
    }
]);

//02. maxRetries syntax

builder.Prompts.choice(session, "Please select : ", "Cat|Dog|Fox",
    {
      listStyle: builder.ListStyle.button,
      maxRetries: 2,
      retryPrompt:'Please Provide invoice no'
    })

//03. Random retry prompt

builder.Prompts.choice(
  session,
  'This is just a random question?',
  'Yes|No',
  { retryPrompt: randomRetry() }
);