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:

Attribute

Type

Required

Description

type

string

always contains

values

array

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") :white-check-mark:
  • equals("hello, how are you?", "hello") :x:
  • equals("hello", "Hello") :x:
  • equals("hello", "bye") :x:

Attribute

Type

Required

Description

type

string

always match_intent

expected

string

expected value

{
    "type": "equals",
    "expected": "hello"
}

Match intent

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

Attribute

Type

Required

Description

type

string

always match_intent

intent.id

string

intent ID to detect

intent.name

string

intent name to detect

intent.type

string

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/) :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.

Attribute

Type

Required

Description

type

string

always match_regexp

pattern

string

a 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:

Attribute

Type

Required

Description

type

string

always 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:

Attribute

Type

Required

Description

type

string

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") :white-check-mark:
  • is_number("1") :white-check-mark:
  • is_number("1,3") :white-check-mark:
  • is_number("hello") :x:

Attribute

Type

Required

Description

type

string

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) :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:

Attribute

Type

Required

Description

type

string

always is_less_than

maximum

number

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) :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:

Attribute

Type

Required

Description

type

string

always is_less_than_or_equal

maximum

number

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) :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:

Attribute

Type

Required

Description

type

string

always is_greater_than

maximum

number

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) :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:

Attribute

Type

Required

Description

type

string

always is_greater_than_or_equal

maximum

number

maximum value

{
    "type": "is_greater_than_or_equal",
    "maximum": 10
}