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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With