Using conditions, you can interlink dialogs based on a set of rules or logic to solve for your use-case in the bot builder. The Conditions tab under a dialog’s setting allows you to do this and more. You can set up multiple conditions for one dialog to connect to another at any point in the flow and set up redirection based on customer input.
With the ability to set up If-else conditions and AND - OR operators in the conditional flow extensively, you can tighten your chatbot flow and tailor it to suit your business requirement.
A quick guide to setting up conditions for a dialog in a chatbot conversation:
- Click on the Conditions icon from the dialog from where the conditional flow needs to be set up.
- On the first field, use the Insert menu, you can choose from one of the values of any of the dialogs, APIs, Properties, or Functions that you have set up.
- Use the second field to set up the comparison. This could be one of the following:
- Not equals
- Greater than
- Less than
- Greater than or equals
- Less than or equals
- Is valid
- Not null
- Not applicable
- In the third field, set up the value to which you are comparing the value from the first field.
Making use of nested logic with AND-OR and else-if operators
You can use multiple operators that are available with these conditions to create the conditional logic that is required.
Let’s go through this with an example to understand it better. Consider a travel agency helping a customer with a bot to plan holidays. The bot will ask questions about the plans to the customer, such as:
- Number of guests
- Preferred locations
- Choice of activities
- Duration of vacation
to name a few. Based on these answers, the bot will gather information about the different holiday packages that fit all of these requirements and present them to the customer.
They could set up your bot to start with the Hello flow, collect this information, and then redirect the customers to specific flows that will each have options for different holiday destinations based on your customer’s requirements. In this case, the conditions tab could look like this: