Multi-Node Workflow Example
This example demonstrates a complex workflow with multiple execution branches, parallel processing, conditional routing, and data merging. Perfect for advanced automation scenarios.Workflow Overview
The workflow implements a data enrichment pipeline:- Webhook Trigger - Receives batch data requests
- Split In Batches - Processes items individually
- IF Node - Routes based on data type
- Parallel Processing - Multiple API calls simultaneously
- Merge Node - Combines enriched data
- Set Node - Final formatting
- Respond to Webhook - Returns processed results
Use Cases
- Data enrichment pipelines
- Multi-source data aggregation
- Parallel API processing
- Complex business logic workflows
- ETL (Extract, Transform, Load) operations
Complete Workflow JSON
Architecture Overview
Step-by-Step Breakdown
Batch Processing Setup
The Split In Batches node processes items in groups of 5 to prevent overwhelming external APIs.Benefits:
- Memory efficient for large datasets
- Respects rate limits
- Progress tracking
- Can resume on errors
Conditional Routing
The IF node routes data to different processing branches based on type.Routes:
- TRUE branch (type=“user”) → User + Metadata API calls
- FALSE branch (other types) → Company + Metadata API calls
Parallel API Calls
Multiple HTTP nodes execute simultaneously within each branch:
- User branch: 2 parallel calls
- Company branch: 2 parallel calls
Data Merging
The Merge node combines results from parallel API calls.Mode: Combine by position (preserves order)
- Input 0: Primary data (User or Company)
- Input 1: Metadata
Data Formatting
The Set node structures the enriched data into a consistent format using n8n expressions to reference multiple node outputs.
Advanced Patterns Explained
Parallel Execution
When an IF node has multiple connections on one output, they execute in parallel:Cross-Node References
The Set node accesses data from multiple previous nodes:Important: Use
$('Node Name') syntax to reference specific nodes. The ?. optional chaining prevents errors when a branch didn’t execute.Batch Loop Pattern
The Loop Over Batches node has three outputs:- Output 0 (null) - Not used
- Output 1 - Loop back to continue processing
- Output 2 - Final output when all batches complete
Expected Response
Performance Optimization
Adjust Batch Size
For faster processing with good APIs:Add Retries
All HTTP nodes include retry configuration:Add Rate Limiting
Insert a Wait node to control request rate:Common Modifications
Add More Route Types
Extend the IF node conditions:Add Database Storage
Insert after Format Enriched Data:Add Error Handling
See Error Handling Example for comprehensive patterns.Debugging Tips
Next Steps
- Implement Error Handling for production resilience
- Build AI Agent Workflows with intelligent routing
- Review Basic Workflows for foundational patterns