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 AI agent 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.
21 comments
Walter
Hi Aimee Spanier, we are testing this in our sandbox, but the branch conditions are not working as expected. For some reason, it always goes to the Else branch even though the conditions for one of the other branches should have been met.
3
Yaniv RECETTE
Hi Aimee Spanier, i have the same problem.
For the reason i don't know, it always go back in the else's branch.
How can i fix this.
thanks
0
Harper Dane
I was running into the same issue as the users above, and I believe I've found the problem.
If you are making an IF/ELSE condition based on a dropdown selection, you must enter the field selection's Tag as the "IF" condition, not the selection Value (agent/customer-facing name).
You can find the field Tag / key in Admin > Objects & Rules > Tickets > Fields. Use the key listed for your selection from the Tags column, not the Value column.
For example, we have a field named "Order Issues" and one of the dropdown options says "File a warranty claim". The Tag / key for that selection is listed as claim_file.
Therefore, my IF statement in Flow Builder needs to say claim_file — not "File a warranty claim".
Hope this helps!
3
Walter
Hey Harper Dane, thanks for that tip!
After changing the value to the tag, it works as expected.
0
Walter
Hi Aimee Spanier, is there any possibility to remove the branch limit?
Is there any reason to limit it to just 6 branches?
1
Rachel Martin
Is there an option to create variables based on the Present Options function? It seems rather limiting to only allow this information to come from API calls or whatever custom fields you already have on a ticket.
1
Lisa Tam
Hey Walter,
Can you share your use-case where you need more than 6 branches? I'm wondering if nested conditions could help with your use case.
0
Lisa Tam
Hey Rachael,
Would the collect information step help with your use case where you can collect information from the end user via a form dropdown? This data can then be used with Branch by condition.
0
Walter
Hi Lisa Tam,
Thanks for your response. I've considered using nested conditions, but our review team does not feel it is a good experience for the customers in this specific scenario. Without giving away too much information, the options we need to provide to the customer exceed 6. And using nested conditions would result in making it almost like we are interrogating a customer. :)
0
AntonMi
Lisa Tam Hello, any visibility into when variables will include authenticated user information?
E.g. if we want to separate flows for authenticated and nonauthenticated users or use external_id/email to get more user info via API?
1
Mark Ganusevič
Good question by Anton, I think this would be a major improvement. 😉
0
Destiny
Thank you for getting in touch.
I recognize that you are experiencing challenges in trying to make the Flow Builder's branch condition limits align with your needs, and you are also inquiring about the possibility of expanding these limits in the future.
It has come to my attention that our team is currently working on a feature that should cater to your requirements, but unfortunately, I don't have any specific details on the expected time of arrival or on the enhancement of the branch limit. In the interim, I recommend exploring the use of Nested conditions within the Flow Builder, which might provide a solution for your current situation. You can find more information about this approach here: Understanding branching conditions.
Please feel free to reach out if you require additional guidance or have other questions. Cheers~!
0
Jham Bernardino
I have recently implemented adding conditions to my flow using a dropdown option. Is there a way for the chatbot analytics to capture the choices I added in the dropdown fields? Additionally, how can I track those interactions that did not result in a handover?
0
Dainne Kiara Lucena-Laxamana
Hi Jhamine,
We do offer Answer Bot analytics in Explore but are limited to the following: Analyzing your Flow Builder activity. Hope this helps!
0
Viachaslau
We would like this limit to be increased. For example, we have 10 transaction types and need a condition for each, with this limit (maximum 6) we can't create a proper custom flow
0
Stephen White
Looking for some assistance here please. I'm looking to use this feature to validate customer information by comparing two variables.
Email = provided by the customer through ‘ask for details’
customeremail = retrieved through a prior API call and stored as a variable
Is this possible? Or perhaps there's a different way to compare info collected with known information stored from API responses?
1
test.zendesk
Thanks for the development on the Zendesk bot so far, it's really nice.
Is it not possible to compare two variables? It is so limited that we have to enter the values to compare with variables manually, what if we want users to make a selection and compare it with the values obtained via API call which is stored in a variable?
0
Martine Hirth
Is it planned to add a condition for an empty/ not empty variable? Thanks :)
2
Viachaslau
Martine Hirth It's possible
1
Martine Hirth
Viachaslau Thank you, it's working now !
0
Jason Kadlec
I plan to set custom fields or tags using the Core API:
zE("messenger:set", "conversationFields", [
{ id: "123456789", value: 100.50 }
])
How do I get the conversationField, or tag to show up in the conditions of the branch by condition?
For ticket fields, I only see email and name.
Messaging Metadata shows only Provided name, Provided email, Authenticated external ID and Authenticated Status.
I know I can set variables using REST api calls to my server, but in this case it's all about what page of my web application the user is on, and/or some button they clicked on, which I need to ‘hard set’ to go to an Answer that is specific to that.
Let's say I have a page of my site called “Playing in sandboxes” and they initiate their chat from this page.
I would
zE("messenger:set", "conversationFields", [
{ id: "123456789", value: sandboxes }
])
And then I would have an answer set as my default_open which would have as the first step a branch by condition which would check for this Ticket Field. If it was “sandboxes” I'm going to route to the answer where the first Send Message says: Hey I see you are playing in the sandbox! Great! Do you have a question for yourself, or your kid?
I don't want to have every interaction with the chat start with “how can I help you” when throughout my app there are pages where.. if the chat is initiated from that page there is a 99% chance I don't need to ask them how I can help.
The specific use case is more like a - click this button to connect to a Sandbox Expert… then the chat bot will load a form which gathers some pre-conversation questions.. then transfers to a live agent.
How do I do this?
0