When you are using your chatbot to ask for information and gather data, it's a good best practice include an alternative option to prevent the chatbot from failing. This is especially useful when the user input needs to be verified. Common examples where this concept is useful are:
- Asking and validating an email address
- Asking and validating a phone number
- Asking and validating an order number
This guide explains how to make an additional branch that will be triggered when the user provides an invalid email address, phone number, or order number. Some concepts that we’ll be using here are capturing user input and looping flows.
In this example, we will ask the user for their email address. We do that by using the Any Text trigger and set it to “should be an Email address” in the right pane. You can set the any text to be any of these:
- Email address
- Phone number
The left branch will be triggered when, in our example, any text contains an email address. And that brings us to the alternative option. What if the user does not provide a valid email address.
When the user doesn’t provide the requested data, then the left branch won’t be triggered and the bot will be stuck or fail as it can not proceed. Therefore it’s important to provide an alternative branch.
The alternative branch is triggered when there is no valid email address to be extracted from the user input. Drag and drop an any text next to your previous any text. Whenever this branch will be triggered, you can give the user an option to try again or to go back to the menu.
Make sure to always test your experience by entering both valid and invalid data.
Updated 4 months ago