Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you go back a step in a waterfall dialog if the user entered wrong data? #botframework

In a dialog, I want to ask the user for his email address. If the user entered an invalid email by mistake, I would like to be able to go back or get into some "loop" situation of keep asking him for his email until he enters a valid one. What's the best way to accomplish that? I couldn't find any way to go back a step in a waterfall dialog.

like image 586
Shahar Avatar asked Apr 10 '16 00:04

Shahar


1 Answers

You can by calling next({ resumed: builder.ResumeReason.back }) but there's actually a better way to do what you're trying to do.

In the latest v0.8.0 version of the library I added a new DialogAction.validatedPrompt() action that lets you create a new prompt with a custom validation routine. With that you can call your '/emailPrompt' dialog instead of Prompts.text() and you won't need to go backwards. Check out the basics-validatedPrompt example to see it in action.

like image 200
Steven Ickman Avatar answered Oct 06 '22 16:10

Steven Ickman