Automation is not a tool — it is a way of thinking. Before you touch a single node, you must see your work as a graph of events, data, and decisions. This chapter builds that mental model, then grounds it in three real workflows you can rebuild in an hour.
1. What is Automation
Automation is any system that performs a task without a human doing it manually every time. In software, it means turning a repeatable process — "when a form is submitted, save it to a sheet and email the team" — into code that runs forever, unattended, at 3am on a Sunday.
- Trigger — the event that starts the workflow (webhook, schedule, new row).
- Steps — the actions performed on the data (transform, call API, filter).
- Outcome — the side-effects (a row written, a message sent, a file saved).
2. A Short History of Automation
- 1980s — Shell scripts & cron. Sysadmins glued binaries with bash.
- 2000s — Enterprise iPaaS. MuleSoft, Boomi. Powerful, but priced for banks.
- 2011 — Zapier. Democratised SaaS-to-SaaS glue with a simple UI.
- 2019 — n8n. Open source, self-hostable, node-based, unlimited steps.
- 2024 — AI-native workflows. LLMs became first-class nodes: routing, extraction, agents.
3. Traditional Automation vs AI Automation
Traditional automation is deterministic: if X happens, do exactly Y. AI automation is probabilistic: given fuzzy input, decide what to do. The best workflows combine both — deterministic plumbing, AI only where reasoning is needed.
4. What is n8n
n8n (pronounced n-eight-n) is an open-source workflow automation platform. You compose workflows visually by connecting nodes. Each node either fetches data, transforms it, or sends it somewhere. Under the hood it runs on Node.js and stores state in SQLite or Postgres. You can self-host it or use n8n Cloud.
5. How n8n Works
Trigger Node ──▶ Action Node ──▶ Action Node ──▶ Output
(Webhook) (HTTP) (Sheets) (Response)
Each arrow carries an ARRAY of items.
Each item is a JSON object: { json: { ... }, binary?: { ... } }6. Nodes & Connections
A node is a single step. A connection is the wire between nodes that carries data. Nodes have inputs (left) and outputs (right). Most nodes have one of each — the IF node has two outputs (true / false), and Merge has two inputs.
7. Executions & Data
An execution is one run of the workflow. Every execution is stored so you can replay it, inspect what each node saw, and debug failures. Click any node after a run to see the exact JSON that flowed in and out.
8. JSON & Expressions
Every item in n8n is JSON. Expressions let you reach into that JSON at runtime using ${{ $json.field }} style syntax. Example:
// Static value
"Hello world"
// Expression — reads from the previous node
={{ $json.customer.name }}
// Combine
=Hello {{ $json.customer.name }}, your order {{ $json.order_id }} is confirmed.9. Triggers & Actions
- Trigger nodes — start a workflow. Webhook, Cron, Email, Telegram Trigger, Manual.
- Action nodes — do work. HTTP Request, Set, Code, Google Sheets, Send Email.
10. Data Flow
Data flows left-to-right as an array of items. If a node emits 10 items, the next node runs 10 times (once per item) unless you turn on "Execute Once". This is the single most important concept in n8n — everything is an array.
11. Workflow Architecture
[Trigger] ─▶ [Validate] ─▶ [Enrich] ─▶ [Route (IF)] ─┬─▶ [Notify Slack]
└─▶ [Save to DB]12. Items, Merge, Split, Loop
- Split In Batches — process 100 rows in chunks of 10 to respect rate limits.
- Merge — combine two branches by index, key, or wait-until-both.
- Item Lists — turn one item with an array field into many items, and back.
- Loop Over Items — explicit iteration when you need a counter.
13. IF & Error Handling
The IF node routes on a condition. For failures, attach an Error Triggerworkflow — any execution that crashes will fire it, so you can post to Slack or write to a log.
14. Environment Variables & Credentials
Never paste an API key into a node. Store it once as a Credential (encrypted at rest with your N8N_ENCRYPTION_KEY), then reference it from any node. Config values that change per environment go in .env and are read with $env.NAME.
15. Execution History
Every run — success or failure — is stored in the executions database. Filter by workflow, by status, by time. Retry a failed execution from the exact node it broke on.
16. Zapier vs Make vs n8n
Zapier Make n8n
Pricing per task per operation free (self-host)
Hosting cloud only cloud only cloud OR self-host
Code node limited yes full Node.js
Complex logic hard medium native
AI nodes add-on add-on first-class
Best for non-devs power users engineers17. Project · Webhook Workflow
- Add a Webhook trigger node. Copy the test URL.
- Add a Set node — create a field greeting = =Hello {{ $json.body.name }}.
- Add a Respond to Webhook node returning {{ $json }}.
- Test with curl:
curl -X POST https://your-n8n.example.com/webhook-test/hello \
-H "Content-Type: application/json" \
-d '{"name": "Sara"}'
# → { "greeting": "Hello Sara" }18. Project · Google Sheets Workflow
- Create a Google Sheet with columns name, email, created_at.
- Add the same Webhook trigger.
- Add a Google Sheets node → operation Append.
- Map name → ={{ $json.body.name }}, email → ={{ $json.body.email }}, created_at → ={{ $now.toISO() }}.
19. Project · Telegram Bot
- Talk to @BotFather, create a bot, copy the token.
- In n8n add a Telegram Trigger → paste the token as a credential → event message.
- Add a Telegram · Send Message node. Chat ID → ={{ $json.message.chat.id }}.
- Text → =You said: {{ $json.message.text }}. Activate. DM your bot.