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

| --- | --- | --- |

The [rule] object

| --- | --- | --- |