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"]) ✅
  • contains("hello, how are you?",["Hello"]) ✅
  • contains("hello, how are you?",["bye", "hello"]) ✅
  • contains("hello, how are you?",["bye"]) ❌
AttributeTypeRequiredDescription
typestring✓always contains
valuesarray<string>✓a 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") ✅
  • equals("hello, how are you?", "hello") ❌
  • equals("hello", "Hello") ❌
  • equals("hello", "bye") ❌
AttributeTypeRequiredDescription
typestring✓always match_intent
expectedstring✓expected value
{
    "type": "equals",
    "expected": "hello"
}

Match intent

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

AttributeTypeRequiredDescription
typestring✓always match_intent
intent.idstring✓intent ID to detect
intent.namestring✓intent name to detect
intent.typestring✓always 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/) ✅
  • matches("hello 12", /\d+/) ✅
  • matches("hello", /\d+/) ❌
📘

Store matched pattern

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

AttributeTypeRequiredDescription
typestring✓always match_regexp
patternstring✓a valid regular expression pattern
{
    "type": "match_regexp",
    "pattern": "[\w]+"
}

Is set

Condition that matches if value is not null.

Examples :

  • is_set("hello") ✅
  • is_set(null) ❌
AttributeTypeRequiredDescription
typestring✓always is_set
{
    "type": "is_set"
}

Is not set

Condition that matches if value is null.

Examples :

  • is_not_set(null) ✅
  • is_not_set("hello") ❌
AttributeTypeRequiredDescription
typestring✓always 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") ✅
  • is_number("1") ✅
  • is_number("1,3") ✅
  • is_number("hello") ❌
AttributeTypeRequiredDescription
typestring✓always 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) ✅
  • is_less_than("12,3", 100) ✅
  • is_less_than("12", 100) ✅
  • is_less_than("12", 1) ❌
  • is_less_than("12", 12) ❌
AttributeTypeRequiredDescription
typestring✓always is_less_than
maximumnumber✓maximum 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) ✅
  • is_less_than_or_equal("12,3", 100) ✅
  • is_less_than_or_equal("12", 100) ✅
  • is_less_than_or_equal("12", 12) ✅
  • is_less_than_or_equal("12", 1) ❌
AttributeTypeRequiredDescription
typestring✓always is_less_than_or_equal
maximumnumber✓maximum 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) ✅
  • is_greater_than("12,3", 10) ✅
  • is_greater_than("12", 10) ✅
  • is_greater_than("12", 12) ❌
  • is_greater_than("12", 100) ❌
AttributeTypeRequiredDescription
typestring✓always is_greater_than
maximumnumber✓maximum 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) ✅
  • is_greater_than_or_equal("12,3", 10) ✅
  • is_greater_than_or_equal("12", 10) ✅
  • is_greater_than_or_equal("12", 12) ✅
  • is_greater_than_or_equal("12", 100) ❌
AttributeTypeRequiredDescription
typestring✓always is_greater_than_or_equal
maximumnumber✓maximum value
{
    "type": "is_greater_than_or_equal",
    "maximum": 10
}