Skip to main content

Logic Nodes

Transform, route, and control message flow with function, switch, change, delay, and more.

Logic Nodes

The backbone of your flows. Logic nodes transform data, route messages, implement conditional branching, and control timing. Master these nodes to build powerful automations.

32 Nodes
3 Core
Transforms

function

Core

Write custom JavaScript code to transform messages and implement complex logic.

Language JavaScript (ES2020+)
Context Node, flow, global
Async Full async/await
Outputs Up to 10 outputs

Configuration

{cfg.key} string JavaScript function body
{cfg.key} number Number of outputs (1-10)
{cfg.key} string Setup code (runs once)
{cfg.key} string Cleanup code (on redeploy)

Output Example

{node.details.output}
Use node.warn() and node.error() for debugging. Access flow context with flow.get/set().

switch

Core

Route messages to different outputs based on property values or expressions.

Conditions ==, !=, <, >, regex
Property Any msg or JSONata
Rules Up to 20 conditions
Otherwise Catch unmatched

Configuration

{cfg.key} string "msg.payload" or expression
{cfg.key} array Array of conditions
{cfg.key} boolean Check all or stop at first
{cfg.key} boolean Reassemble sequences

Output Example

{node.details.output}
Use "otherwise" rule to catch unmatched messages. JSONata enables complex routing.

change

Core

Set, change, delete, or move message properties without code.

Operations Set, change, delete, move
Targets msg, flow, global
Values String, number, JSON
Regex Search/replace support

Configuration

{cfg.key} array Array of change operations
{cfg.key} string "set" | "change" | "delete" | "move"
{cfg.key} string Target property path
{cfg.key} any New value or expression

Output Example

{node.details.output}
Prefer change nodes over function nodes for simple transformations.

delay

Delay messages or rate-limit throughput for controlled processing.

Modes Fixed, random, rate limit
Units Milliseconds to days
Queue Configurable size
Drop Option when full

Configuration

{cfg.key} string "delay" | "rate" | "queue"
{cfg.key} number Delay duration
{cfg.key} string "milliseconds" | "seconds"
{cfg.key} number Messages per time period

Output Example

{node.details.output}
Use rate-limit mode to prevent flooding APIs. Send msg.reset to clear the queue.

filter

Filter messages based on conditions, remove duplicates, or sample data.

Modes Block unless changed
Compare Value or deep equality
Deadband Ignore small changes
Property Filter on any prop

Configuration

{cfg.key} string "rbe" | "deadband" | "narrowband"
{cfg.key} string Property to monitor
{cfg.key} number Deadband threshold
{cfg.key} any Initial value state

Output Example

{node.details.output}
Great for reducing sensor noise. Use deadband for analog sensors.

sort

Sort message sequences by property value or custom comparison.

Sort by Property or expression
Order Ascending/descending
Sequence Respects msg sequences
Type Number, string, custom

Configuration

{cfg.key} string Property to sort by
{cfg.key} string "msg" | "jsonata"
{cfg.key} string "ascending" | "descending"
{cfg.key} boolean Treat as numbers

Output Example

{node.details.output}
Works with split node sequences. Use with join node to reassemble.

batch

Group messages into arrays for bulk processing and database inserts.

Modes Count, interval, concat
Count Group by msg count
Interval Group by time window
Overlap Sliding window support

Configuration

{cfg.key} string "count" | "interval" | "concat"
{cfg.key} number Messages per batch
{cfg.key} number Time window in seconds
{cfg.key} number Sliding window overlap

Output Example

{node.details.output}
Essential for efficient database writes. Reduces I/O by 10-100x.

Common Flow Patterns

Route by Type

Use switchfunction to route messages by type, then process each with specialized logic.

Filter & Batch

Use filterbatch → database to filter valid readings, batch them, then bulk insert.

Transform & Delay

Use changedelay → output to transform format, rate-limit, then send notifications.

Aggregate Data

Use batchfunction to collect readings, then calculate averages or totals.