Utilising the Branch by condition step in Flow Builder enables you to assess data stored in variables and steer a messaging bot conversation according to that information. We're going to look at a live example of how you can use the Branch by condition option below. We'll cover the following topics below:
- Understanding branching conditions
- Creating a live example in your Zendesk
- Customizing the live example to suit your needs
Understanding branching conditions
You can read more information about branching conditions in the Zendesk guide here: Understanding branching conditions.
Creating a live example in your Zendesk
In order to create a live example inside your Zendesk account to check out the Branch by condition set in action, you'll need to create a new answer inside Flow Builder for your bot. By looking at a live example it will help you understand how you can use a branch by condition step in your own flow builder configuration.
- In Admin Center, click
Channels > Bots and Automations > Bots > Answers > Create Answer.
- A new window will appear where you can select to create an answer from a blank template or utilise one of the example templates provided. Select the Cancel Order Template.
You'll now see the new flow for the Cancel order answer template. When looking at the flow, you'll see the Branch by condition steps towards the bottom.
In this case, the "Branch by condition" step is used to determine what should happen next. This decision depends on the results from the API call that was made earlier.
Context:
- The Make API call step is running an API call to an external order system to check the status of the user's order.
- Based on the results that are returned from the Make API call step, the Branch by condition step is then utilised to determine what should happen next.
In the example below, after the API call checks on the order status, if the order has been cancelled already, the bot will surface an article to the customer
Customizing the live example to suit your needs
Once you have a better understanding of how the Branch by condition step operates after viewing the live example in your account, you can simply edit the live example to suit your own workflow. Alternatively, you can use this live example as a guide, and build your own version from scratch using the Blank template option.
Condition tips
Variables:
- You can have up to 6 variables in a branch by condition.
- Check out more information on variables here: Using variables to personalise bot answers
Field Tag:
When creating an IF/ELSE condition based on a dropdown choice, it's important to use the field selection's Tag as the "IF" condition, rather than the actual selection Value (the name seen by agents/customers).
To locate the field tag, navigate to Admin > Objects & Rules > Tickets > Fields. Look for the key associated with your chosen selection in the Tags column, not the Value column.
For instance, let's consider a field called "Order Issues," with one of the dropdown options labelled "Cancel my order." The Tag/key for this particular choice is indicated as "cancel_order".
Consequently, when setting up the IF statement in Flow Builder, it should reference "cancel_order", not the display text "Cancel my order."