D: Ever felt like your automations need smart decision-making? The n8n If Node is your secret weapon! π οΈ This powerful node lets you create branching workflows based on conditions, making your automations smarter and more dynamic.
In this ultimate guide, weβll break down the If Node with 10 real-world examplesβfrom simple checks to advanced logic. Letβs dive in!
π What is the n8n If Node?
The If Node evaluates conditions and routes data based on whether theyβre true
or false
. Think of it as a traffic controller π¦ for your workflowβsending data down different paths depending on rules you set.
Key Features:
β
Supports multiple conditions (AND/OR logic)
β
Works with data from previous nodes (e.g., JSON, numbers, text)
β
Customizable comparisons (=
, >
, <
, contains
, etc.)
π οΈ 10 Practical If Node Examples
1οΈβ£ Basic Email Filtering
Scenario: Sort emails into “Important” and “Others” based on subject keywords.
Condition:
π IF `{{$node["Gmail"].json["subject"] contains "URGENT"}}` → Branch A (Send Slack alert)
π ELSE → Branch B (Archive email)
2οΈβ£ E-Commerce Discount Checker
Scenario: Give discounts to orders over $100.
Condition:
π° IF `{{$node["Shopify"].json["orderTotal"] > 100}}` → Apply 10% discount
π³ ELSE → Proceed to checkout
3οΈβ£ Social Media Auto-Reply
Scenario: Reply differently to tweets with hashtags.
Condition:
π¦ IF `{{$node["Twitter"].json["text"] contains "#support"}}` → Send help guide
β€οΈ ELSE IF `contains "#feedback"` → Send thank-you message
4οΈβ£ Weather-Based Alert System
Scenario: Notify if rain is forecasted.
Condition:
β IF `{{$node["OpenWeather"].json["weather"] == "Rain"}}` → SMS alert "Bring an umbrella!"
βοΈ ELSE → Do nothing
5οΈβ£ CRM Lead Scoring
Scenario: Tag high-value leads (score > 75).
Condition:
π IF `{{$node["HubSpot"].json["leadScore"] > 75}}` → Tag as "Hot Lead"
π ELSE → Tag as "Follow Up"
6οΈβ£ Form Response Router
Scenario: Route survey responses to different teams.
Condition:
π IF `{{$node["Typeform"].json["feedbackRating"] < 3}}` → Send to "Complaints" team
π ELSE → Send to "Success" team
7οΈβ£ Inventory Restock Alert
Scenario: Trigger a purchase order if stock is low.
Condition:
β οΈ IF `{{$node["Airtable"].json["quantity"] < 10}}` → Email supplier
π ELSE → Update inventory log
8οΈβ£ Time-Based Greeting
Scenario: Send “Good Morning/Evening” messages.
Condition:
π
IF `{{$node["DateTime"].json["hours"] < 12}}` → Send "Good Morning"
π ELSE → Send "Good Evening"
9οΈβ£ Failed Payment Retry
Scenario: Retry failed transactions under $50.
Condition:
π΄ IF `{{$node["Stripe"].json["status"] == "failed" AND amount < 50}}` → Retry payment
π’ ELSE → Log error
π Multi-Language Support
Scenario: Route customer queries by language.
Condition:
π¬π§ IF `{{$node["Zendesk"].json["language"] == "en"}}` → English support
πͺπΈ ELSE IF `== "es"` → Spanish support
π‘ Pro Tips for If Node Success
πΉ Use Javascript
for complex logic (e.g., date comparisons, regex).
πΉ Test conditions separately with the “Execute Node” feature.
πΉ Combine with Switch Node for multi-route workflows.
π― Final Thoughts
The n8n If Node turns rigid workflows into intelligent, adaptive systems. Whether filtering data, routing tasks, or triggering alerts, mastering conditions unlocks next-level automation.
π Try these examples in your workflows today! Need help? Drop a comment below. π
#n8n #Automation #Workflow #NoCode #IfNode