How to use Conditional Logic
What is conditional logic?
Conditional logic allows you to create rules for your customers to meet. These rules can be used to direct customers down different, more relevant parts of your bot's conversation.
Once you set up a set of conditional logic rules there will be 2 paths created that your customers can go down. The first path is the TRUE path, this is when a customer meets all the requirements of the rules. The second path is the FALSE path, this is the path that your customer will be taken if they don't meet the requirements of your rules.
Why is this useful?
It creates a much more personalised and human experience for your customers. An example would be setting a conditional logic rule to check if a customer's email is known. So If the customer has visited before and you already know their email address they could go down the TRUE path which would let them skip the email address question.
This removes any repetitive questions making customers experience better and increases their chances of completing the conversation.
In this article we cover:
- How to use conditional logic
- How conditional logic appears in the preview
- How to use custom variables in conditional logic
- When to use Match all these rules or Match any of these rules
How to use Conditional Logic
Conditional logic is an object that is set inside the messages section of your bot. To start using conditional logic you need to find the bot you wish to edit, then go to the messages section inside the bot builder.
- Drag a conditional object onto your canvas and connect it in the conversation. In this example, I am going to use a conditional logic rule to check if the customer's name is known. If it is known I want to skip the question asking for their name and take them to the next question.
- The next step is setting the rules for this conditional logic object. So click on the object to edit it and then start creating your conditional logic rules. In this example, I click to edit the modal, then select the name rule, check that it is set to IS KNOWN and save my changes.
- Now that you have your rules set you need to connect the different TRUE and FALSE paths and you are done! In this example, my rule is checking if the customer's name is known. So if the customer's name is known it will render as TRUE so I set that path to skip the name object and go straight to the email object. If the customer's name is not known, it will be rendered as false and will take them to the name object.
How Conditional Logic appears in the preview
Conditional logic will never be seen by the customer when it is like on your site.
However, for testing purposes, we do show you when you reach a conditional logic object in the preview. We show you the different rules that are set and ask you to make a choice of whether you want to go down the TRUE or FALSE path.
Using custom variables with Conditional Logic
When a customer answers a question in your bot's conversation, you can store that answer in a custom variable. This custom variable can then be used to set a conditional logic rule.
In this example, I am going to use a conditional logic rule to check if the customer's answered yes to an earlier multiple choice question.
When to use Match all these rules or Match any of these rules
You are able to set multiple rules for one conditional logic object. You have a choice on how you want the logic to be determined as TRUE or FALSE.
Match all these rules
This option means that all of the rules that are set in your conditional logic object will need to be true in order for the customer to be taken down the TRUE path.
Match any of these rules
This option means that you can set multiple different rules but as long as one requirement is matched then the customer will be taken down the TRUE path.