Using conditions, you can interlink dialogs based on a set of rules or logic to solve 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 extensively set up If-else conditions and AND - OR operators in the conditional flow, you can tighten your chatbot flow and tailor it to suit your business requirement.


Setting up conditions for a dialog

  • Click on the Conditions icon from the dialog where you want the conditional flow to be set up and click on + New condition from the sidebar.



  • You will have three fields to set up the conditional logic and a fourth field to establish what should happen when the conditions are met.



  • On the first field, use the Insert menu to choose from one of the values of any of the Dialogs, APIs, Properties, Functions, or Integrations you have set up.


  • Use the second field to set up the comparison. This could be one of the following:
    • Equals
    • 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 compare the value from the first field.



Note: A condition set up for a dialog is triggered only after the dialog and all actions are processed. This is important to note especially when using dynamic placeholders in the conditions which might change based on the dialog and actions.


Making use of nested logic with AND-OR and else-if operators

You can use multiple operators available with these conditions to create the required conditional logic.



Note: If you configure multiple conditions to the same dialog, they will trigger in the same order ss they are listed on the Conditions sidebar.

 

Here's an example:

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


Based on these answers, the bot will gather information about the different holiday packages that fit 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 with options for different holiday destinations based on your customer's requirements. In this case, the conditions tab could look like this: