Conditions

This object is responsible for the validation of value according to configured conditions.

Contain

Condition that matches if value contains one of the values present in values.
This condition is case insensitive.

Examples :

  • contains("hello, how are you?", ["hell"]) :white-check-mark:
  • contains("hello, how are you?", ["Hello"]) :white-check-mark:
  • contains("hello, how are you?", ["bye", "hello"]) :white-check-mark:
  • contains("hello, how are you?", ["bye"]) :x:
AttributeTypeRequiredDescription
typestringalways contains
valuesarraya list strings that should match the value
{
    "type": "contains",
    "values": ["hello"]
}

Equal

Condition that matches if value equals the expected one.
This condition is case sensitive.

Examples :

  • equals("hello", "hello") :white-check-mark:
  • equals("hello, how are you?", "hello") :x:
  • equals("hello", "Hello") :x:
  • equals("hello", "bye") :x:
AttributeTypeRequiredDescription
typestringalways match_intent
expectedstringexpected value
{
    "type": "equals",
    "expected": "hello"
}

Match intent

Condition that matches if the intent is detected in the value.

AttributeTypeRequiredDescription
typestringalways match_intent
intent.idstringintent ID to detect
intent.namestringintent name to detect
intent.typestringalways intent
{
    "type": "match_intent",
    "intent": {
        "id": "c1c1c1c1c1c1c1c1c1c1c1c1",
        "name": "an intent",
        "type": "intent"
    }
}

Match regexp

Condition that matches if value matches a regular expression.

Examples :

  • matches("hello", /hello/) :white-check-mark:
  • matches("hello 12", /\d+/) :white-check-mark:
  • matches("hello", /\d+/) :x:

📘

Store matched pattern

If you want to store a matched pattern in a session value, it is easily possible. Just follow this tutorial.

AttributeTypeRequiredDescription
typestringalways match_regexp
patternstringa valid regular expression pattern
{
    "type": "match_regexp",
    "pattern": "[\w]+"
}

Is set

Condition that matches if value is not null.

Examples :

  • is_set("hello") :white-check-mark:
  • is_set(null) :x:
AttributeTypeRequiredDescription
typestringalways is_set
{
    "type": "is_set"
}

Is not set

Condition that matches if value is null.

Examples :

  • is_not_set(null) :white-check-mark:
  • is_not_set("hello") :x:
AttributeTypeRequiredDescription
typestringalways is_not_set
{
    "type": "is_not_set"
}

Is number

Condition that matches if value is a number.
Floats can have . or a , as delimiter.

Examples :

  • is_number("1.3") :white-check-mark:
  • is_number("1") :white-check-mark:
  • is_number("1,3") :white-check-mark:
  • is_number("hello") :x:
AttributeTypeRequiredDescription
typestringalways is_number
{
    "type": "is_number"
}

Is less than

Condition that matches if value is less than another number.

Examples :

  • is_less_than("12.3", 100) :white-check-mark:
  • is_less_than("12,3", 100) :white-check-mark:
  • is_less_than("12", 100) :white-check-mark:
  • is_less_than("12", 1) :x:
  • is_less_than("12", 12) :x:
AttributeTypeRequiredDescription
typestringalways is_less_than
maximumnumbermaximum value
{
    "type": "is_less_than",
    "maximum": 10
}

Is less than or equal

Condition that matches if value is less than or equal to another number.

Examples :

  • is_less_than_or_equal("12.3", 100) :white-check-mark:
  • is_less_than_or_equal("12,3", 100) :white-check-mark:
  • is_less_than_or_equal("12", 100) :white-check-mark:
  • is_less_than_or_equal("12", 12) :white-check-mark:
  • is_less_than_or_equal("12", 1) :x:
AttributeTypeRequiredDescription
typestringalways is_less_than_or_equal
maximumnumbermaximum value
{
    "type": "is_less_than_or_equal",
    "maximum": 10
}

Is greater than

Condition that matches if value is greater than another number.

Examples :

  • is_greater_than("12.3", 10) :white-check-mark:
  • is_greater_than("12,3", 10) :white-check-mark:
  • is_greater_than("12", 10) :white-check-mark:
  • is_greater_than("12", 12) :x:
  • is_greater_than("12", 100) :x:
AttributeTypeRequiredDescription
typestringalways is_greater_than
maximumnumbermaximum value
{
    "type": "is_greater_than",
    "maximum": 10
}

Is greater than or equal

Condition that matches if value is greater than or equal to another number.

Examples :

  • is_greater_than_or_equal("12.3", 10) :white-check-mark:
  • is_greater_than_or_equal("12,3", 10) :white-check-mark:
  • is_greater_than_or_equal("12", 10) :white-check-mark:
  • is_greater_than_or_equal("12", 12) :white-check-mark:
  • is_greater_than_or_equal("12", 100) :x:
AttributeTypeRequiredDescription
typestringalways is_greater_than_or_equal
maximumnumbermaximum value
{
    "type": "is_greater_than_or_equal",
    "maximum": 10
}