1
votes

I read the Bot document somewhere people posted if you replace dialog then previous dialog store in stack and stored somewhere.

Now I tried to follow the way to endDialog() then replaceDialog();

callRequest.GetWebAPICall(session, urlData, function (body) {
        if(body.statusCode == 200) { 
            if(body.data == undefined) { 
                builder.Prompts.choice(session,Want to Select List?", "Yes|No",{listStyle: builder.ListStyle.button});
            } else { 
                session.endDialog();
                session.replaceDialog('/Show List');                
            }
        } else {
            session.send('Something went wrong. You can use the back or top command.');
            session.replaceDialog('/menu');
        }
    });

For need to know if I replace below lines

session.endDialog();
session.replaceDialog('/Show List');  

by

session.endDialog('/Show List');
1

1 Answers

2
votes

No. endDialog() doesn't have the functionality to start a new dialog. You can refer to the function definition interface endDialog(message?: TextOrMessageType, ...args: any\[\]): Session;.

In your case, '/Show List' would be sent to the user as a message.

And there is also a misunderstanding about replaceDialog().

Ends the current dialog and starts a new one its place. The parent dialog will not be resumed until the new dialog completes.

If you need to store the previous dialog, you can use beginDialog()