When you are using your chatbot to ask for information and to gather data it might be wise to include an alternative option to avoid a chatbot fail. This is especially useful when the user input should 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
In this guide we will show you how to make an additional branch that will be triggered when the user provides an invalid e-mail 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 his or her 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, the 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.
The Alternative option
When the user doesn’t provide, in our case, a valid email address 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 will be 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 might want to give the user an option to try again or to go back to the menu.
Try it out
Make sure to always test your experience. With the example above we can easily do that by using the try it out. We can now see that in the first attempt we don’t provide an email address and the right branch is triggered. We loop back and try again and we provide a valid email address that is recognized. Happy flow-designing!