Loop Node
It enables batch actions and powerful automation for lists of data.
Purpose
- Processing List Items: Run steps for each item in a collection (e.g., process each order).
- Data Enrichment: Fetch or transform additional info for each array item.
- Batch Operations: Perform actions like sending multiple emails or creating many records.
Configuration
Configurable properties:
Property | Type | Description | Default |
---|---|---|---|
label | string (optional) | Descriptive name for the node instance. | 'Loop' |
inputArrayPath | string (optional) | Path to the array in input data (dot notation or JSONPath). | '' |
Input Array Path Syntax
Important: Specify the inputArrayPath
syntax:
- Path Language: Dot notation (
orders
) or JSONPath ($.orders
). - Validation: If the path is invalid or not an array, define whether to show error, skip, or run
loopEnd
only. - Examples:
orders
for"orders": [...]
customer.details.tags
(for nested arrays)
Inputs and Outputs
Input (Left Handle, id: "input"
):
Receives the object with the array to process.
Outputs:
loopBody (Right Handle, id:
"loopBody"
):
Triggered for each item in the array found atinputArrayPath
.
Data: The individual item (optionally, index/context depending on implementation).loopEnd (Right Handle, id:
"loopEnd"
):
Triggered once after all items are processed or immediately if array is empty.
Data: The original input data (optionally, aggregated results).
Iteration Logic
- Data arrives at the input handle.
- Node resolves
inputArrayPath
to find the array. If
inputArrayPath
is invalid or not an array:- Define: show error, skip, or just trigger
loopEnd
.
- Define: show error, skip, or just trigger
If the array is empty:
loopBody
not triggered.loopEnd
triggered immediately.
If array has items:
- For each item, trigger
loopBody
, passing the current item. - After all, trigger
loopEnd
(optionally, after sub-workflows finish).
- For each item, trigger
Execution Model
Synchronous (sequential) vs. asynchronous (parallel) loop execution changes workflow results—clarify in docs for your engine.
Example: Sending Welcome Emails
Input Data Example:
{
"newUsers": [
{ "name": "Alice", "email": "alice@example.com" },
{ "name": "Bob", "email": "bob@example.com" },
{ "name": "Charlie", "email": "charlie@example.com" }
]
}
Node Configuration:
- label: Email New Users
- inputArrayPath: newUsers
Workflow Connections:
loopBody connects to:
- Transform Node to format an email using
name
andemail
. - HTTP Request Node to send the email.
- Transform Node to format an email using
loopEnd connects to:
- Notification Node (when all done), or Logging Node.
Execution:
- loopBody runs 3 times:
- First: Alice,
- Second: Bob,
- Third: Charlie.
- After last email, loopEnd is triggered.
Notes and Considerations
- Performance: Large arrays with slow or complex
loopBody
flows can slow the workflow. Consider batching or async patterns. - Error Handling: Define what happens if an error occurs in one iteration (continue, stop, or collect errors).
- Aggregation: If you want to collect results from all items, handle it via downstream logic after
loopEnd
.
The Loop Node unlocks repetitive automation for any data list in your flows.