Conditions
Use conditional logic to control the flow and display messages only if the specified conditions are met.
Here is an example:
{
"type": "question",
"entity": "sum",
"entity-type": "Number",
"messages": [
"How much is 2 + 2?"
]
},
{
"conditions": [
"{{$eq sum 4}}"
],
"type": "message",
"messages": [
"✅ Correct."
]
},
{
"conditions": [
"{{$ne sum 4}}"
],
"type": "message",
"messages": [
"❌ Incorrect."
]
}
Check all of the supported conditional expressions you can use.
Entity presence
You can check if an entity is defined in the bot memory using the $has
formatter.
You can use the $in
formatter to check if an entity value is present in an array.
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
Boolean logic
You can evaluate boolean logic using some of the boolean formatters:
$or
$and
$not
Somethings missing or not clear?
Ask a question in our community forums or submit a support ticket.