A condition consists of the following fields:
name: Simply what you want to name the condition to distinguish it.
The list of one or more
rules. Rules all evaluate to either
false, and consist of the following:
check forattribute, which can include either an entity or a context variable.
operator, which has to be one of the following:
- is equal to
- is not equal to
- is greater than
- is less than
- does not contain
- does not exist
value, to be compared with the
check forattribute via the
operator. It is omitted when the operator is
matchoperator. It can be one of the following:
ALL: All rules must evaluate to
ANY: At least one of the rules must evaluate to
ELSE: The rest of the conditions are not satisfied.
Examples of different responses
In the following image, you can see an example, in which the response is different based on the
$amount context variable.
You can see the use of a condition, in which if the context variable
$amount is more than $50, the user sees that no extra shipping is due, otherwise the user sees that they have to pay an extra $5 in shipping.
In the following example, you can see that the virtual assistant checks for the
$sys-channel variable which is a system variable that stores the communication channel.
You can also create a condition based on entities. The following example shows a dialog, in which the condition checks if for the
@payment-methods entity. If the value that the brain recognized is
cash, the response is the appropriate. Otherwise, the assistant tells the user what the available payment methods are.
You can use tags in order to remember that a specific dialog has been triggered. Hence, a specific dialog can tag the conversation such that future dialogs can alter responses accordingly. In the following example, registered customers are separated from the unregistered ones by using a condition. The condition checks for the variable
$tags. If the assistant has already assigned the tag , then the response is that there is no shipping fee. Otherwise, the response is that a $5 shipping fee is applied.