AI Automation

n8n Tutorial for Beginners: Build Your First AI Automation (Step by Step)

A beginner-friendly n8n tutorial: what n8n is, how to set it up, and how to build a real AI-powered lead capture workflow with a form, AI classification, Google Sheets and email, without writing code.

BIGXSTAR Academy Teamยทยท11 min read
n8nAI AutomationNo-CodeWorkflow AutomationTutorialSmall Business

n8n (pronounced "n-eight-n") has become one of the most popular tools for AI automation. It lets you connect apps and AI models into workflows using a visual editor, and you can run it on your own server if you need to keep data in-house.

In this tutorial you will build a real automation that a small business can use on day one: an AI-powered lead capture workflow. No coding required.


What is n8n?

n8n is a workflow automation tool. You build workflows on a canvas by connecting nodes:

  • A trigger node starts the workflow: a form submission, a new email, a schedule, a webhook
  • Action nodes do things: add a row to Google Sheets, send an email, call an API
  • AI nodes use language models to classify, extract, summarise or act as an agent
  • Logic nodes branch and transform data: IF, Switch, Merge, Edit Fields

Data flows from node to node as JSON, and you can use values from earlier nodes in later ones.

n8n vs Zapier, Make and Power Automate

n8n's main differences are that it can be self-hosted, it is very flexible for technical users, and it has strong built-in AI nodes. Zapier is often the easiest to start with, Make is very visual, and Power Automate fits naturally if your company runs on Microsoft 365. We compare them in detail in n8n vs Make vs Zapier vs Power Automate.


Step 1: set up n8n

You have two options.

Option A: n8n Cloud. Sign up on the n8n website and start a trial. Nothing to install. Best if you just want to learn.

Option B: self-host with Docker. Best if you want control over your data or to avoid per-workflow pricing. With Docker installed, run:

bash
docker volume create n8n_data
docker run -it --rm --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n

Then open http://localhost:5678 in your browser and create your owner account. The volume keeps your workflows and credentials when the container restarts.

Note that n8n is "fair-code" licensed: free to self-host for your own internal use, with commercial terms for some other uses. Check the licence if you plan to offer n8n as a service to clients.


Step 2: understand three core ideas

1. Items

Each node outputs a list of items, each one a JSON object. A form submission produces one item; reading a spreadsheet might produce a hundred. Most nodes run once per item automatically.

2. Expressions

To use data from an earlier node, use an expression inside double curly braces. For example, in an email node:

Hi {{ $json.name }}, thanks for contacting us!

$json refers to the current item's data. You can also drag fields from the input panel on the left into a parameter, and n8n writes the expression for you.

3. Credentials

Connections to Google, Gmail, Slack, AI providers and so on are stored as credentials, encrypted and reusable across workflows. You set each one up once.


Step 3: build an AI lead capture workflow

The goal: when someone fills in an enquiry form, the workflow should:

  1. Use AI to classify the enquiry as Sales, Support or Other, and score its urgency
  2. Save it to a Google Sheet
  3. Email the sales team immediately if it is an urgent sales lead
  4. Send the person a friendly acknowledgement

Node 1: Form trigger

Add an n8n Form Trigger node ("On form submission"). Add fields:

  • Name (text, required)
  • Email (email, required)
  • Phone (text)
  • Message (textarea, required)

n8n gives you a form URL you can share or embed on your website. Submit a test entry so the next nodes have sample data to work with.

Node 2: AI classification

Add an AI node to classify the message. You can use a Text Classifier node, or a basic LLM chain with a clear prompt, connected to a chat model credential from your AI provider.

A good prompt for this step:

Classify this customer enquiry.

Message: {{ $json.Message }}

Return JSON with:
- category: one of "Sales", "Support", "Other"
- urgency: one of "High", "Normal"
- summary: one sentence, under 20 words

Mark urgency "High" only if the customer mentions a deadline,
a large order, or is ready to buy now.

Ask for structured output (JSON with fixed values) rather than free text. That way the next nodes can reliably branch on category and urgency. Many n8n AI nodes have an option for a structured output parser; use it.

Node 3: Save to Google Sheets

Add a Google Sheets node with the "Append row" operation. Connect your Google credential, choose a spreadsheet, and map columns: Date, Name, Email, Phone, Message, Category, Urgency, Summary.

This sheet becomes your simple lead tracker.

Node 4: Branch with IF

Add an IF node: continue on the "true" branch when category equals Sales and urgency equals High.

Node 5: Alert the sales team

On the "true" branch, add a Gmail (or Slack, or Microsoft Teams) node that sends:

Subject: ๐Ÿ”ฅ Urgent sales lead: {{ $json.Name }}

{{ $json.summary }}
Phone: {{ $json.Phone }}
Email: {{ $json.Email }}

Field names depend on how your earlier nodes name things. Use the drag-and-drop field picker to get them right.

Node 6: Acknowledge the customer

Add a separate branch (from the Sheets node) with an email to the person who submitted the form: a short thank-you and when to expect a reply.

Tip: keep this message fixed, or have AI draft it but not send it automatically until you have tested it on many real enquiries. A wrong AI-written promise sent to a customer is worse than a plain template.

Test and activate

Use Test workflow, submit a few varied enquiries ("I want 200 units by Friday", "My invoice is wrong", "Do you have a careers page?") and check each path. When it works, toggle the workflow to Active.


Step 4: make it reliable

A workflow that works once is a demo. A workflow you can rely on needs a bit more:

  • Error workflow: n8n lets you set a workflow that runs when another fails. Use it to alert you by email or Slack.
  • Retries: enable "Retry on fail" on nodes that call external services.
  • Validate AI output: if the AI returns something unexpected, route it to a "needs review" path instead of failing silently.
  • Protect personal data: you are handling names, emails and phone numbers. Limit who can access the sheet, and be careful which AI services receive customer data. India's DPDP Act applies.
  • Watch costs: AI calls cost money per request. For high volumes, use a smaller, cheaper model for simple classification.

What to build next

Once this works, try:

  • Invoice data extraction: read PDF invoices from email, extract fields with AI, append to a sheet
  • Email triage: classify incoming support email and draft replies for a human to approve
  • Daily summary: a scheduled workflow that summarises yesterday's leads and sends a digest
  • An AI agent: n8n's AI Agent node can use tools (look up a sheet, call an API) to answer questions

More ideas, by business function: AI automation for small businesses: 15 practical use cases.


Learn hands-on, in a weekend or six weeks. Our 2-day AI Automation Workshop builds three ready-to-use automations like this one with n8n and AI, live online. For a deeper skill set (Make, Zapier, Power Automate, AI agents, reliability and a capstone on your own business process), join the 6-week AI Automation for Business course. No coding needed for either.