Conditions are the way to differentiate your response based on Entities or Context Variable. Conditions are part of Trigger Nodes.

A Condition consists of:

  • A name (can be whatever you wish)
  • A match operator. It can either be All, Any or Else
  • A list of rules

Each rule evaluates to either True or False. A rule consists of:

  • The check for attribute. It can either be an Entity or Context Variable
  • An operator, which compares the check for attribute to
  • A specific value

For example a specific rule can check that the context variable $payment_methods is equal to card (Click here for more).

Different response based on the order

In the example above a condition has been attached to the Dialog in order to separate the answer that the virtual assistant will give when an end-user asks about the shipping cost. A Context Variable $amount has been created in order to save the information about the money that the user spent for this order. So if the amount is less than 50$ the assistant will answer with “there is a shipping fee of 5$”, in any other case will answer with “there is no extra shipping fee”.

Different response based on the communication channel

In this example you can see that the virtual assistant checks for sys-channel which is a Context Variable that stores all communication channels. So, if you communicate with the assistant through Viber you will receive the response with the carousel otherwise you will receive the text message which is shown in the example above.

If you want to find out how to differentiate based on the Tagged Dialog, click here.

Last updated on