Conditions

Conditions define tests that will either be true or false. You will find conditions in different parts of your skill:

  • in the trigger section
  • in the requirements validation
  • in each message group in the action section

Conditions types

There are two types of conditions group:

  • and
  • or

Recast.AI - Bot condition

You can see in this example two groups:

  • the first group (in line) is an and condition group
  • the second group (the entire block) is an or condition group

Data conditions

data conditions are blocks that are evaluated and can be either true or false. You can create data conditions with:

In this example, we test:

  • if the intent is greetings
  • if the sentiment analyzed in the sentence is negativ
  • if in the conversation memory, the value saved for city is paris

Recast.AI - Bot condition

Operands

Inside your data conditions, you will find a list of operands.

  • Operands starting by @ will get the associated intent (for example @greetings)
  • Operands starting by # will get the associated entity (for example #location), and will test the raw field
  • Operands starting by _ will get the associated field in the text analyze JSON or in the conversation state.

Note: You are able to write the entire path if you need, like:

  • #location.lat (if you need the latitude) is the same as nlp.entities.location.lat

Operators

Inside your data conditions, several operators are available:

  • is: tests if the values are equal
  • is-not: tests if the values are inequal
  • in: tests if the left value is included in a list of values
  • not-in: tests if the left value is not included in a list of values
  • matches: tests if the value matches a regular expression
  • matches-not: tests if the value does not matche a regular expression
  • lower-than: tests if the value is a number lower than a value
  • greater-than: tests if the value is a number greater than a value
  • is-present: tests if the value is present
  • is-absent: tests if the value is not present

Note: the regex syntax follows the Ruby regex syntax.

Next stepTriggers