Skip to main content

Message Object

Learn how to manipulate the message object

A flow consists of nodes and every flow contains one or more trigger nodes that inject a message object into the flow. A node may have zero or one input port and zero, one, or more than one output port.

A node receives a JSON message from its input port and outputs the same or updated message from its output port. Only trigger nodes inject a new message object into the flow.

Flow

Every message object has a unique id when initially injected into the flow. In the above example Inject node injects a new message after the flow starts running.

The initial message object injected by Inject node looks something like below:

{
id: "twou796nwbdy9bpmbw7e15yxia",
payload: 1634730234524
}

This object is changed throughout the flow by the nodes either updating or adding / deleting fields.

In the above flow, a special and powerful node called the "Function" node is used to manipulate the message object manually. Function node is mostly used for gluing logic between nodes or some special code. You can reach the script editor of the Function node by clicking Edit action.

Edit

Add the below code and press Save.

msg.isUpdated = true;
return msg;

This script adds a new field named "isUpdated" to the message object. The new message object now becomes something like below:

{
id: "twou796nwbdy9bpmbw7e15yxia",
payload: 1634730234524,
isUpdated: true;
}

The example flow shown on this page uses Debug nodes to probe the message object. These debug outputs can be seen in the Flow Designer Panel.

Debug Output