Module 10Lesson 6

Lesson 6. Conditions and Branching: IF Node

Hands-on: n8n

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#

  1. Click "+" to the right of the Set node

  2. Find the IF node

  3. Configure the condition:

    • Value 1: {{ $json.price }}

    • Operation: Larger (greater than)

    • Value 2: 50000

  4. 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#

  1. Click "+" on the top output of the IF node

  2. Add the Telegram node

  3. Configure the message:

    • Text: Bitcoin is rising! Price: ${{ $json.price }} πŸš€

Step 4. Add Telegram Node to the "false" Branch#

  1. Click "+" on the bottom output of the IF node

  2. Add the Telegram node

  3. Configure the message:

    • Text: Bitcoin is stable. Price: ${{ $json.price }}

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:

  1. Cron (trigger: every day at 11:00 PM)

  2. Google Sheets (action: Read, read all rows)

  3. Convert to File (convert data to CSV)

  4. 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:

  1. Google Sheets Trigger (trigger: On Row Added)

  2. 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:

  1. Cron (trigger: every hour)

  2. HTTP Request (get Ethereum price via CoinGecko API)

  3. Set (extract price)

  4. IF (price > 3000?)

  5. Telegram (true branch: "Ethereum is rising!")

  6. IF (price < 2000?) β€” connect to the false branch of the first IF

  7. 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#

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:


Materials for the Website#

Flashcards#

Key n8n Terms1 / 8
Known: 0 (0%)
Question

n8n

πŸ‘† Click to flip

Answer

Open-source platform for automation and integrations. Visual workflow builder: nodes are connected by arrows to pass data.

πŸ‘† Click to flip back

Test Yourself

Check

1. What is n8n?
2. How does n8n differ from Zapier?
3. What is a Node in n8n?
4. Which node is used to run a workflow on a schedule?
5. What does the expression {{ $json.price }} mean in n8n?
6. Which node is used to perform actions depending on a condition?
7. What do you need to configure in the Telegram node to send a message?