Lesson 6. Conditions and Branching: IF Node#
Goal: learn to build logic with conditions (if... then... else...).
Task#
Get the Bitcoin price. If the price is above $50,000 β send "Bitcoin is rising! π". Otherwise β send "Bitcoin is stable".
Step 1. Use the Workflow from Lesson 5#
Open the "Bitcoin Price" workflow (or create a new one).
Scheme:
Manual Trigger β HTTP Request β Set β IF β Telegram
Step 2. Add IF Node After the Set Node#
-
Click "+" to the right of the Set node
-
Find the IF node
-
Configure the condition:
-
Value 1:
{{ $json.price }} -
Operation: Larger (greater than)
-
Value 2:
50000
-
-
Click "Execute Node"
What happens:
The IF node has two outputs:
-
true (top branch) β if the condition is met (price > 50000)
-
false (bottom branch) β if the condition is not met (price β€ 50000)
Step 3. Add Telegram Node to the "true" Branch#
-
Click "+" on the top output of the IF node
-
Add the Telegram node
-
Configure the message:
- Text:
Bitcoin is rising! Price: ${{ $json.price }} π
- Text:
Step 4. Add Telegram Node to the "false" Branch#
-
Click "+" on the bottom output of the IF node
-
Add the Telegram node
-
Configure the message:
- Text:
Bitcoin is stable. Price: ${{ $json.price }}
- Text:
Step 5. Test#
Click "Execute Workflow" β depending on the current price, one of the branches will run.
Done! You've learned how to create branching logic.
Module Practice#
Practice Task 1: Automatic Google Sheets Backup#
Task: every day at 11:00 PM, copy data from Google Sheets and send a CSV file to yourself in Telegram.
Nodes:
-
Cron (trigger: every day at 11:00 PM)
-
Google Sheets (action: Read, read all rows)
-
Convert to File (convert data to CSV)
-
Telegram (send file)
Checklist:
-
Workflow created
-
Cron set to 11:00 PM
-
Google Sheets connected (credentials configured)
-
Data converted to CSV
-
File sent to Telegram
-
Workflow activated
Practice Task 2: New Lead Notification#
Task: when a new row is added to Google Sheets (table "Leads"), send a Telegram notification: "New lead: [Name] ([Email])".
Nodes:
-
Google Sheets Trigger (trigger: On Row Added)
-
Telegram (send message)
Checklist:
-
"Leads" table created (fields: Name, Email)
-
Google Sheets Trigger configured
-
Telegram credentials configured
-
Testing: added a row β received message
-
Workflow activated
Practice Task 3: Price Monitoring with Condition#
Task: every hour, check the Ethereum price. If the price is above $3000 β send "Ethereum is rising!". If below $2000 β send "Ethereum is falling!". Otherwise β don't send anything.
Nodes:
-
Cron (trigger: every hour)
-
HTTP Request (get Ethereum price via CoinGecko API)
-
Set (extract price)
-
IF (price > 3000?)
-
Telegram (true branch: "Ethereum is rising!")
-
IF (price < 2000?) β connect to the false branch of the first IF
-
Telegram (true branch: "Ethereum is falling!")
Checklist:
-
Workflow created
-
Cron set to every hour
-
HTTP Request works (gets Ethereum price)
-
Conditions configured (> 3000, < 2000)
-
Telegram credentials configured
-
Testing: run manually, both branches checked
-
Workflow activated
Artifacts#
After completing the module you will have:
1. Three Working Workflows in n8n#
-
Morning Notification (Cron + Telegram)
-
Bitcoin Price (HTTP Request + Telegram)
-
Price Condition (HTTP Request + IF + Telegram)
2. Understanding of n8n Basics#
-
what nodes are and how to connect them
-
how to make HTTP requests
-
how to process JSON
-
how to build conditions (IF)
3. Checklist "How to Create a Workflow in n8n"#
-
Define the task (what the workflow should do)
-
Choose a trigger (Cron, Webhook, Manual, service trigger)
-
Add action nodes (HTTP Request, Google Sheets, Telegram, etc.)
-
Configure credentials (API keys, tokens)
-
Test each node (Execute Node)
-
Add logic (IF, Switch) if needed
-
Test the entire workflow (Execute Workflow)
-
Save and activate the workflow
What's Next: Resources for Deeper Learning#
Official Documentation#
-
n8n Documentation: docs.n8n.io
-
n8n Community Forum: community.n8n.io
-
n8n YouTube: workflow examples and tutorials
English Courses and Resources#
1. "n8n for Beginners" course (YouTube)
-
search for popular tutorials and creators
-
duration: 3β5 hours
-
topics: from installation to complex automations
2. n8n Community Forum
- workflow examples, news, discussions
3. Courses on Udemy / Coursera / Udacity
- search for n8n courses; they appear regularly
What to Learn Next (Advanced Level)#
If you want to continue learning n8n, here are topics for deeper study:
1. Advanced nodes:
-
Code (JavaScript) β write custom code to process data
-
Function β create reusable functions
-
Loop β process lists in a loop
-
Split In Batches β process large data arrays in chunks
2. AI Integration:
-
OpenAI β text generation, content analysis
-
Pinecone / Weaviate β vector databases for AI
-
LangChain β build chains with AI models
3. Working with Databases:
-
PostgreSQL / MySQL / MongoDB β direct connection to databases
-
SQL queries β read and write data via SQL
4. Error Handling:
-
Error Trigger β what to do when a workflow fails
-
Retry β retry requests on errors
5. Webhook and API:
-
Webhook β receive data from external services
-
Respond to Webhook β send a response back
6. Optimization and Scaling:
-
Sub-workflows β break complex workflows into parts
-
Queue Mode β process tasks in a queue (for high load)
Where to Find Ready-Made Workflows#
1. n8n Templates:
- n8n.io/workflows β library of ready-made workflows (import with one click)
2. GitHub:
- search for repositories with n8n workflows (examples: email automation, CRM integration, data parsing)
3. Community Forum:
- users share their workflows (forum: community.n8n.io)