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"]) ❌
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") ✅
- equals("hello, how are you?", "hello") ❌
- equals("hello", "Hello") ❌
- equals("hello", "bye") ❌
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/) ✅
- 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.
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") ✅
- is_set(null) ❌
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) ✅
- is_not_set("hello") ❌
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") ✅
- is_number("1") ✅
- is_number("1,3") ✅
- is_number("hello") ❌
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) ✅
- is_less_than("12,3", 100) ✅
- is_less_than("12", 100) ✅
- is_less_than("12", 1) ❌
- is_less_than("12", 12) ❌
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) ✅
- 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) ❌
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) ✅
- is_greater_than("12,3", 10) ✅
- is_greater_than("12", 10) ✅
- is_greater_than("12", 12) ❌
- is_greater_than("12", 100) ❌
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) ✅
- 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) ❌
Attribute | Type | Required | Description |
---|---|---|---|
type | string | ✓ | always is_greater_than_or_equal |
maximum | number | ✓ | maximum value |
{
"type": "is_greater_than_or_equal",
"maximum": 10
}