Nodes
In a no-code visual editor, nodes must be connected to create functional systems. Bot Studio has two types of nodes:
- Default Nodes: Available across all platforms and can be used universally. For example, statement nodes are used to check if a condition is met.
- Platform-Specific Nodes: Available only on a specific platform and cannot be used on others. For example, a node that sends messages in a Telegram channel cannot send messages in a Discord channel.
Additionally, nodes are categorized into two other types:
- Event Nodes: Used to listen for incoming events. For example, in a Telegram bot, an event node can listen for incoming messages and trigger subsequent nodes.
- Worker Nodes: Used to further process the workflow.
For instance, sending a message to a channel is a worker node function, while listening for incoming messages in a channel is an event node function. Event nodes are essential for initiating processes, and they must be connected to worker nodes to create a functional system.
Node Structure
All nodes include the following parameters:
id
: The unique identifier for the node, represented as a number.name
: The node's name, indicating its primary task. This is a string.data
: An object containing the node's data. For example, if a node sends a message, this parameter would include the message text and channel ID.outputs
: An object containing the node’s outputs, including all subsequent connected nodes. A node may have multiple outputs that can be connected to other nodes.
These four parameters are required for every node. Additional parameters, such as the node's position within the editor, are not essential.
Node ID
Each node must have a unique ID, which can be any number. A flow cannot include two nodes with the same ID. While any number can be used, it is recommended to assign IDs sequentially.
Node Name
The node's name defines its functionality. For example, a node named "Send Message" sends a message, while a node named "Delete Message" deletes a message. Node names always start with an uppercase letter.
Node Data
The data
parameter specifies the data needed for the node’s function. For example, when sending a message to a channel, the channel_id
and message
must be specified. Event nodes typically do not require specific data. If a node doesn't require data, pass an empty object.
Node Outputs
The outputs
parameter connects a node to other nodes. We focus on outputs since processes always move forward. The outputs object includes all connected subsequent nodes. For example, a conditional node might have true
and false
outputs, each connected to different nodes.
Outputs are objects that contain:
node
: The ID of the connected node.input
: The input name of the connected node.
If an output is a json
node, it can only be connected to json
inputs. JSON connections transfer data between nodes and do not trigger node execution. All nodes, except event nodes, have an "action" input, meaning their outputs can connect to the "action" input of worker nodes. Event nodes do not have inputs.
Most nodes have an "action" output, except certain nodes mentioned in this documentation. For example, "Condition" and "Random" nodes do not have "action" outputs but use their own outputs to execute subsequent nodes.