You can configure the Branch by condition step to evaluate data stored in variables and branch a messaging bot conversation based on that data.
This article includes the following sections:
Branch by condition step basics
When you add a new Branch by condition step to your answer flow, the following settings are included:
- Name that identifies the step on the canvas.
-
Two default branches
that must be configured before the answer
flow can be published:
- If this: If the branch's conditions are met, the conversation follows the branch's steps
- Else: If the conversation doesn't match the conditions of any other branch, the conversation follows this branch's steps
Branch by condition can have up to six branches, including the Else branch. The Else branch is required and cannot be removed from the step. You can add up to four additional branches, to a maximum of six branches.
To add an additional branch, click Add branch and configure the following settings for each branch:
- Name that describes the condition for the branch. This name appears as the branch name on the canvas.
-
Condition
that includes the following elements:
- Variable: The data that will be evaluated to see if the condition is met.
- Operator: How the data from the variable and value are compared. Includes is, is not, contains, and does not contain.
- Value: Value expected for the condition specified by the operator.
See Condition elements for more information.
You can combine conditions for a branch using the AND/OR drop-down. For example, the following branch checks whether a user is located in Australia or the United States.
A conversation can only follow one branch. Branches are evaluated in the order they are included in the step. End users that meet the criteria of more than one branch will be sent down the first branch with matched criteria, from top to bottom in the step's configuration panel or left to right on the canvas. Branches can be reordered by dragging the condition panes on the canvas.
Condition elements
About variables
In a condition, a variable's value is compared to a static value. Variables are added to the condition using a drop-down menu.
For more information about variable types and creating variables, see Using variables to personalize bot answers.About operators
The operator determines how the variable's data is compared to the value. Operators are added to a condition using a drop-down menu.
The following operators are available. All operator matching is case-insensitive.
When I’m using the conditional step in bot builder… | Available operators |
---|---|
I want to be able to evaluate data stored as a number |
Operators for Zendesk known use cases for evaluating numbers:
|
I want to be able to evaluate data stored as a string |
Operators for Zendesk known use cases for evaluating strings:
|
About values
A value is static data that's compared to a variable.
It represents the expected data for a variable. For example, in a condition that
checks whether a customer's
membership_status
is "platinum",
"platinum" is the value.
The input field used to specify a condition's value varies based on the variable. For the Authenticated status variable, you specify the condition's value using a boolean drop-down field. For other variables, you specify the condition's value using a text input field.
membership_status
drop-down field accepts a "Platinum
level" value with a related "platinum_level" tag. To check whether the customer
has a platinum membership status, use "platinum_level" as the value in the
condition.
Nested conditions
A nested condition is a condition that contains two or more conditions inside it. You can use nested conditions to build complex logic that relies on multiple conditions. They are especially useful when combining conditions using both AND and OR.
- The user has a “platinum” membership status AND
- The user is located in one of the following countries:
- Australia OR
- The United States
You can only nest conditions up to three levels deep. Each level, including the top level, can contain up to six conditions.