Message Object

Learn how to manipulate the message object

A flow consists of nodes and every flow contains one or more trigger nodes that injects 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 injects a new message object to the flow.

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

Initial message object injected by Inject node looks something like below

{
id: "19eur76szffipywn7jyonscity",
payload: 1579269571332
}

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

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

Below script adds a new field "isUpdated" to the message object.

Function
msg.isUpdated = true;
return msg;

The new message object now becomes something like below

{
id: "19eur76szffipywn7jyonscity",
payload: 1579269571332,
isUpdated: true;
}

Example flow in this page uses Debug nodes to probe the message object. These debug outputs can be seen at the Flow Designer Panel.