Logic, Routing & Branching
Real-world automation is never a straight line. This lesson teaches you to build workflows that make decisions: routing data down different paths, merging parallel branches, and processing items conditionally with IF nodes, Switch nodes, and Merge nodes.
IF Node — True or False Branching
The IF node is the most fundamental decision-maker in N8N. It evaluates a condition and sends each item down either the true output or the false output. Think of it as a fork in the road for your data.
{{ $json.status }}), select an operator (equals, contains, greater than, etc.), then enter the right operand value to compare against.Condition: {{ $json.order_status }} equals "shipped"
True path → Send "Your order is on its way!" email
False path → Send "Your order is still being processed." email
Switch Node — Multi-Path Routing
When you have more than two possible routes, use the Switch node. It routes each item to one of up to 4+ output ports based on the value of a field, similar to a switch/case statement in programming.
Field: {{ $json.priority }}
Output 0 → equals "critical" → PagerDuty alert
Output 1 → equals "high" → Slack message
Output 2 → equals "low" → Spreadsheet log
Fallback → (anything else) → Email digest
Merge Node — Combining Branches
After branching with IF or Switch, you often need to bring data back together — for example, to send a single final email regardless of which path was taken. The Merge node does exactly this.