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

1

7

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.

Wojak answered 10/4, 2016 at 0:46 Comment(0)
M
4

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.

Modigliani answered 10/4, 2016 at 4:51 Comment(1)
as per libray version 3.8, validatedPrompt() has been deprecated and you should use session.replaceDialog('dialogName', { reprompt: true }); instead. Check the docs for reference.Tailrace

© 2022 - 2024 — McMap. All rights reserved.