-
-
Notifications
You must be signed in to change notification settings - Fork 199
Rules node
Guidone edited this page Jan 20, 2018
·
9 revisions
Rules node is a multi-output node that allows to control the flow of the chatbot based on simple rules (for example "The topic is myTopic", "The context variable myVar is not defined"). This node replace the Topic node that will deprecated soon.
The first rule that matches trigger the redirect of the incoming message to the related output and stops the chain of rules.
This node is useful to create loops in the flow, for example to keep asking some questions to the user until a list of needed information (context variables) are filled.
Rules can be created programmatically by an upstream Function node passing array of rules in the message payload:
msg.payload = [
{
type: 'hasNotVariable',
variable: 'my_variable'
},
{
type: 'catchAll'
}
];
return msg;
Available parameters for the msg.payload
| Name | Type | Description |
|---|---|---|
| rules | array of [rule] | The list of rules |
The [button] object
| Name | Type | Description |
|---|---|---|
| type | string | Type of rule: inbound, outbound, isTopicEmpty, catchAll, isNotTopic, isTopic, hasNotVariable, hasVariable |
| topic | string | Match the rule if the flow topic matches/doesn't match the specified topic. Required for isNotTopic and isTopic |
| variable | string | Match the rule if the context variable is defined/not defined. Required for hasVariable and hasNotVariable |