Conditions

Use conditional logic to overwrite the the default flow and only display certain messages if specified conditions are met.

Entity presence

You can check if an entity is defined in the bot memory using the $has formatter.

    <!-- '{ "FirstName": "John", "LastName": "Smith" }' -->
    {{$json user}}

    <!-- true -->
    {{$has user.FirstName}}

    <!-- false -->
    {{$has user.MiddleName}}

You can use the $in formatter to check if an entity value is present in an array.

    {{$in date datesArray}}

Comparisons

You can evaluate comparisons using some of the comparison formatters:

  • $eq - equals
  • $gt - greater than
  • $gte - greater or equal
  • $lt - less than
  • $lte - less or equal
  • $ne - not equal
    <!-- 5 -->
    {{grade}}

    <!-- true -->
    {{$gt grade 3}}

Boolean logic

You can evaluate boolean logic using some of the boolean formatters:

  • $or
  • $and
  • $not
    <!-- 4 -->
    {{grade}}

    <!-- true -->
    {{$and ($gt grade 3) ($lt grade 5)}}