Dynamic Node

The Dynamic Node is used to create dynamic nodes based on some logic written in JavaScript.

This is an advanced node. You need have the knowledge of Javascript to use this node.

You need to write body of a function which takes user as parameter and returns list of nodes or actions as a response. Below is the format of function.

function(user) {
    //your logic goes here
    return {
        nodes:[]
    };
}

You need to write only body of the function. To refer to the complete user object with all of the fields please check go to this link.

the function should return nodes in required JSON format. Below is the format of json for each type of nodes. Please note that all nodes are not supported here. Below are nodes which are supported.

Add and send data

{
      "node_type": "TEXT",
      "txt": "<desired text>",
}

Collect User Data

{
  "node_type": "QUICK_REPLY",
  "actions_on_response": [],
  "text": "<text before quick reply>",
  "responses": [//array of responses
    {
      "txt": "<option 1>"
    },
    {
      "txt": "<option 2>"
    },
    {
      "txt": "<option 3>"
    }
  ],
  "option_display_mode": "",// one of "HORIZONTAL" "VERTICAL" "DROPDOWN"
  "placeholder": "<placeholder in case of dropdown such as Type to search..>"
}

Last updated