Conditions
This section describes the use of conditions within flows. A condition is used to make certain behaviours conditional, like:
skipping a node
guarding a trigger
branching
What are conditions?
Conditions consist of one or more rules, also referred to as expressions. An expression is like an equation, where two or more values are compared to each other in a predefined way.
The binary addition of the results of all the separate rules will result in either a true or a false outcome for the condition as a whole. This outcome determines the execution of the logic bound by the condition. For example, when the condition is used for the Skip when option of a node, it will skip the node if it evaluates to true.
Where are conditions used?
Skipping a node
When you want certain Flow nodes to be skipped in certain circumstances you can use conditions as "skip logic". Every node in your Flow has the option to be skipped based on a condition. This feature is available in the Advanced section of the properties panel of your Flow node.

Guarding a trigger
Triggers to your Flows can be guarded by conditions so you can have different entry points for different scenarios. This enables you to have a different Flow based on user or conversation variables.

Branching
Another way to make your Flow behave conditionally is by adding a branch node to your Flow. The branches will be executed from left to right, where the first branched condition that evaluates to true will be executed.

How to build a condition
By clicking on the Add condition button, a popup appears in which the condition can be specified. As explained, a condition consists of one or more expressions.
Rule types
A rule can be based on:
tags
channels
any of the variables

Rules based on tags
The easiest and most commonly used way to create a rule is by checking the existence of certain tags in your conversation. Therefore, the condition type is set to Tags by default:

The way the tags are evaluated depends on which expression type is used to compare the selected tags:
Any of
One or more of the given tags are set
All of
All given tags are set
None of
None of the provided tags are set

The above screenshot shows an example where either the user's phone number or their email address needs to be set for the condition to evaluate to true. This works because the platform will automatically set a user tag when the user's phone number or email address is known, see User tags.
In the above example, the condition evaluates to true if at least one of the tags is present. If the use case requires both to be present, you should set the expression type to All of. If, on the other hand, you want to check if none of these fields are present, you should select None of.
Rules based on channels
When multiple channels are available to your Smart App, you might want to execute certain logic based on the channel the conversation is running in. This can easily be done using the rule type Channel.

In this example, the condition will only validate as true on phone channels, which prevents this logic from being executed on any of the other channels.
Rules based on variables
The most advanced way of evaluating rules is using variable comparison. By using logical operators (see next paragraph) the user and/or conversation variables can be compared to certain values in order for the condition to evaluate true or false. For example, when the phone number is equal to a certain number or the user's name is equal to a certain name.

Operators
You already saw in the above examples, the operator ==
being used in a rule to compare a variable to a value and to compare a channel to one of the channel options. There are also other expression operators that can be used. For instance, to check if a variable does not equal, i.e. is different from, a certain value.

The following table describes the different operators in more detail.
Is empty
to check if A has no value, often used to check if a question was not asked yet.
Email Is Empty
Is not empty
to check if A has a value, often used to check if a question is already asked
Email Is not empty
Add another rule
As explained in the beginning of this chapter, conditions consist of one or more rules. So when you have configured your first rule, feel free to try adding another rule by hovering your mouse over the rule. Now you see two buttons appear: Add rule and Add group. In this paragraph we will focus on adding a new rule.

The new rule can be built in the same way, but now we also need to indicate if this rule adds to the previous rule (And) or whether the new rule applies separately (Or), in which case just one of the two rules needs to evaluate to true instead of both.

Add a group
When building complex conditions, you might want to use groups. A group of rules is evaluated as one. Just as with mathematical evaluations, groups work like parentheses. In this example: (1+1) x (2+2) evaluates to 2 x 4 = 8. When not using parentheses, the equation would lead to something completely different: 1 + 1 x 2 + 2 = 5.
A group can be added by hovering the mouse over one of the rules and clicking on the Add group button:

For conditions it works the same way, so consider the following example:

In this example, the condition evaluates to true when either the system is online and the first name of the user is Niels, OR when the system is offline while the first name is not yet set.
Last updated
Was this helpful?