
n8n Tutorial: Build a Real Lead Workflow
A beginner n8n tutorial built on workflows we run in production: a website lead webhook to Slack, then an AI booking agent with tools. Setup, gotchas, costs.
This n8n tutorial builds the same kind of workflow that runs our own business. Leads from the White Space website, whether they come through the contact form, a landing page or our chat assistant, land in an n8n workflow through a webhook. And the booking agent behind our voice assistant is an n8n AI agent that checks a calendar and books the call. By the end you will have built a simpler version of the first one and know how the second one is put together.
n8n is a workflow automation tool. You connect nodes on a canvas: a trigger that starts the workflow, then steps that move and change data between your apps. It sits in the same category as Zapier and Make, with two differences that matter: you can self-host it for free, and you can drop into JavaScript anywhere you need to.
Should you use n8n, Zapier or Make?
| n8n | Zapier | Make | |
|---|---|---|---|
| What you pay for | Workflow executions (any number of steps), or nothing if self-hosted | Tasks (each step counts) | Operations (each module run counts) |
| Self-hosting | Yes, free Community Edition | No | No |
| Code inside workflows | JavaScript and Python Code nodes | Limited | Limited |
| AI agents | Built-in AI Agent node with tools and memory | AI actions | AI modules |
| Easiest for a first automation | No | Yes | Close |
The pricing difference is the one that bites. A 10-step workflow that runs 1,000 times is 10,000 tasks on Zapier and 1,000 executions on n8n. If you are new to automation and need one simple zap, Zapier is faster. If you will run many multi-step workflows, or you want AI agents that call your own tools, n8n is worth the steeper start. We compared the three in more depth in Make vs n8n vs Claude Code. If your team's work lives in Notion, check what Notion's built-in automations cover before adding another tool.
Set up n8n
n8n Cloud is the fast route. As of October 2026, n8n's pricing page lists Starter at $20 a month for 2,500 executions and Pro at $50 a month for 10,000, both billed annually, with Business at €667 a month for 40,000. Every plan counts executions, not steps.
Self-hosted costs only the server. To try it on your own machine:
docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n n8nio/n8n
Then open http://localhost:5678. n8n asks you to create an owner account on first load.
For a server that receives webhooks from the internet, run it with Postgres and tell n8n its public address, or the webhook URLs it shows you will point at localhost:
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_HOST=n8n.yourdomain.com
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://n8n.yourdomain.com/
- GENERIC_TIMEZONE=America/Chicago
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_PASSWORD=change-me
volumes:
- n8n_data:/home/node/.n8n
depends_on:
- postgres
postgres:
image: postgres:16
restart: always
environment:
- POSTGRES_USER=n8n
- POSTGRES_PASSWORD=change-me
- POSTGRES_DB=n8n
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
n8n_data:
postgres_data:
Put it behind HTTPS (Caddy or a Cloudflare tunnel both work) before you point a live form at it. Set GENERIC_TIMEZONE to your own zone so scheduled workflows fire when you expect.
Four ideas that make n8n click
Nodes. Each step is a node. Trigger nodes start a workflow (a webhook, a schedule, a new row in a sheet). Every other node does one job: call an app, branch on a condition, reshape data.
Items. Data moves between nodes as a list of items, each one a JSON object. If a node outputs 20 items, the next node runs 20 times, once per item. Most beginner confusion in n8n comes from not knowing this.
Expressions. Any field can switch from a fixed value to an expression in double curly braces that reads data from earlier nodes:
{{ $json.email }} // field from the previous node
{{ $('Webhook').item.json.body.name }} // field from a named node
{{ $json.email.trim().toLowerCase() }} // plain JavaScript works too
Executions. Every run is saved with the data each node received and produced. When something breaks, open the execution and click through the nodes. That log is the best debugging tool n8n has.
Build your first workflow: website lead to Slack
This is a stripped-down version of what our site does with every lead. You need a Slack workspace you can post to.
1. Add a Webhook trigger. Create a new workflow, add a Webhook node, set the method to POST and the path to new-lead. n8n shows two URLs: a test URL and a production URL. The test URL only listens while you have clicked "Listen for test event". The production URL only works once the workflow is active. Mixing them up is the most common reason a beginner's webhook "does nothing".
2. Send it a test lead. Click "Listen for test event", then from a terminal:
curl -X POST "YOUR_TEST_URL" \
-H "Content-Type: application/json" \
-d '{"name":"Dana Lee","email":"dana@example.com","company":"Lee Roofing","message":"Need help with follow-up"}'
The node now shows the lead under body. Click the pin icon on the output so you can keep building without resending.
3. Clean the fields. Add an Edit Fields (Set) node. Create name, email and company from {{ $json.body.name }} and so on, and lowercase the email. Later nodes read these clean names instead of digging into body.
4. Drop junk. Add an If node that continues only when email is not empty and contains @. On our site this filter barely fires, because submissions flagged as spam never reach n8n in the first place.
5. Post to Slack. Add a Slack node on the true branch, choose "Send a message", pick your leads channel and write the text with expressions: New lead: {{ $json.name }} ({{ $json.company }}), {{ $json.email }}.
6. Go live. Toggle the workflow to active and swap the URL in your form or test call to the production URL. Send one more test and check Slack.
From here, a CRM node (HubSpot, Pipedrive or an HTTP Request to any API) on the same branch puts the lead in your pipeline.
Why our site saves the lead before it calls n8n
Our forms do not send leads only to n8n. The website writes every lead to its own Postgres database first, then posts the lead's id, fields and attribution to the n8n webhook, and records whether the delivery succeeded. If n8n is down, mid-upgrade or rejects the payload, the lead is still saved and the failed delivery can be resent.
That is the most useful design rule I can give a beginner: n8n is great at moving data between systems, but it should not be the only place a lead exists. Keep the system of record somewhere durable and let n8n handle the routing.
Going further: an AI agent with tools
n8n's AI Agent node gives a language model a set of tools and lets it decide which to call. Our booking agent works like this: the voice assistant hands n8n the caller's request, the agent checks availability with one tool and creates the booking with another, and each tool is its own small workflow.
The pattern is worth copying:
- Each tool is a sub-workflow. It starts with the "When Executed by Another Workflow" trigger, and you declare its inputs there (for example
eventTypeId). The agent's tool node lists those inputs and fills them. - The model fills inputs with
$fromAI(). An input set to{{ $fromAI('service', 'Which service the caller wants', 'string') }}asks the model to supply that value at run time, with your description as its instructions. - One value drives both tools. Our agent passes the same
servicevalue to the availability tool and the booking tool, so it never checks one calendar and books on another.
Two things cost us time, and neither was obvious to us from the docs:
- The editor preview lies about
$fromAI(). The result panel showsundefinedor blank, because the value only exists while the agent runs. If the red "invalid syntax" warning is gone, the expression is fine. Test with real runs, not the preview. - Keep tool-input expressions simple. In our booking agent's input fields, object literals and the
??operator both produced "invalid syntax". We mapped the service to an id with an array lookup and a||fallback instead:
{{ [101, 102, 103][['consult', 'website', 'mail'].indexOf($fromAI('service', 'One of: consult, website, mail', 'string'))] || 101 }}
(The ids here are placeholders. Use your own calendar's event type ids.)
Mistakes to avoid
- Leaving the test URL in a live form. It stops working the moment you close the editor.
- No error workflow. Create a workflow that starts with an Error Trigger and posts to Slack, then select it under each workflow's settings. Without it, failed runs fail silently.
- Building on live data every time. Pin a node's output once and build against it. You stop hammering APIs and stop creating duplicate test records.
- Putting secrets in expressions. Store keys as n8n credentials, which are encrypted, never as text inside a node.
- One giant workflow. Split shared steps into sub-workflows. It is the same pattern the AI agent uses, and it keeps each piece testable.
Questions people ask
Is n8n free? Self-hosting the Community Edition is free; you pay for the server. Read n8n's license before you build a product that resells n8n itself as a service.
Do I need to code? No. The workflow in this tutorial uses no code beyond expressions. The Code node is there when a transformation is easier to write than to click together.
What if n8n has no node for my app? Use the HTTP Request node. Anything with an API works, with the same credentials system.
What to build next
Point your real contact form at the workflow you just built, add your CRM, and set up the error workflow. Then pick the next repetitive handoff in your business, such as a new customer, a missed call or a weekly report, and give it the same treatment.
If you would rather have it built and maintained for you, n8n included, that is what our AI workflow automation services cover.
Founder & CEO, White Space Solutions
Jason builds AI automation systems for real estate investors and business owners. With experience spanning data analytics, direct mail automation, AI voice agents, and revenue intelligence, he helps companies replace manual workflows with intelligent systems that drive measurable results.
Related Articles
Airtable Automations: Setup, Limits, Fixes
How Airtable automations work, run limits by plan, five to build first, and fixes for the common problems: double runs, silent failures and races.
Google Sheets Automation: Formulas to Scripts
Google Sheets automation, from formulas to Apps Script triggers and connected apps. Working code, Google's real quotas, the trigger mistake that breaks emails.
Notion Automations: What They Can and Can't Do
Notion automations explained: every trigger and action, which plans include them, buttons, and the limits behind most silent failures.
n8n vs Claude Code vs Make: 2026 Comparison
n8n vs Claude Code, head to head, plus Make. Which one fits a non-technical operator, which fits an engineer, and where each one stops being the right tool.