Back to Insights
Tutorial

Build AI agents with n8n: practical tutorial for SMBs

4 min lezen
Build AI agents with n8n: practical tutorial for SMBs — practical AI guide for SMEs

With n8n you build AI agents without a developer. Step by step create a working agent that reads emails, looks them up in your CRM, and drafts a response.

Years ago you needed a developer to build an AI agent. Not anymore in 2026: with low-code tools like n8n you can build working agents in a day. This tutorial gives you a working example: an agent that reads incoming emails, retrieves customer context from HubSpot, and writes a draft response.

What is n8n?

n8n is an open-source workflow automation tool. Comparable to Zapier or Make, but:

  • Self-hosted option (data stays in your own environment)
  • More powerful logic and code steps
  • Hundreds of built-in integrations
  • AI nodes for OpenAI, Anthropic, etc.

Ideal for SMBs who want more control than Zapier, but can't maintain a developer team.

What we're going to build

An agent that:

  1. Trigger: new email in inbox info@company.nl
  2. Reads subject and content
  3. Searches sender in HubSpot CRM
  4. Retrieves open deals and recent notes
  5. Generates a draft response via OpenAI/Claude
  6. Creates a draft in Outlook/Gmail for human sending

Step 1: Set up n8n

Option A: n8n cloud

  • Go to n8n.cloud
  • Create an account (€20-€50/month for SMB use)

Option B: Self-hosted

  • Install Docker
  • `docker run -it --rm -p 5678:5678 n8nio/n8n`
  • Access via http://localhost:5678
  • For production: deploy to a server (DigitalOcean, Hetzner) with SSL

Step 2: Add email trigger

In n8n:

  1. Create new workflow
  2. Trigger: "Gmail Trigger" or "IMAP Email Trigger"
  3. Connect your email account (OAuth for Gmail, IMAP credentials for others)
  4. Filter: for example only emails to info@

Step 3: HubSpot lookup

  1. Add node: "HubSpot - Contact - Get Many"
  2. Authenticate with API key from HubSpot
  3. Filter by sender email address:
  • Field: email
  • Value: `{{ $json.from.value[0].address }}`

Step 4: Retrieve deals

  1. Add node: "HubSpot - Deal - Get Many"
  2. Filter by contact ID from previous step
  3. Select relevant properties: deal name, deal stage, amount

Step 5: AI node for draft

  1. Add node: "OpenAI" or "Anthropic Claude"
  2. Model: GPT-4o-mini or Claude Haiku (cost/speed)
  3. System prompt:
  1. User prompt:

Step 6: Save draft in inbox

  1. Add node: "Gmail - Draft - Create" (or Outlook variant)
  2. To: `{{ $('Email').item.json.from.value[0].address }}`
  3. Subject: "RE: {{ $('Email').item.json.subject }}"
  4. Body: `{{ $('OpenAI').item.json.message.content }}`

Step 7: Test and activate

  1. Run "Test workflow" on a test email
  2. Check if the draft looks correct
  3. Activate the workflow (toggle in top right)

What does this cost?

  • n8n cloud: €20-€50/month
  • OpenAI API: approximately €0.01-€0.05 per email (depending on model)
  • HubSpot: existing license

Budget €60-€150/month for a setup that handles 500-2000 emails per month.

Next steps

First version working? Then improve it:

  1. Add knowledge base: a database with FAQ answers the agent can draw from
  2. Sentiment routing: angry emails go straight to humans, neutral ones via AI draft
  3. Multi-language: detect language and respond in the same language
  4. Categorization: automatically tag emails (sales, support, complaint)
  5. Auto-send: for high confidence and simple questions, send directly instead of draft

Three pitfalls

  1. Let AI send directly without review: always start with "create draft", only upgrade to auto-send once quality is proven
  2. No logging: log every step, otherwise debugging is impossible
  3. Forget privacy: add GDPR disclaimer to your privacy statement for automated processing

Conclusion

With n8n you build a working AI agent in a day. For SMBs, it's the golden middle ground between "building a simple Zapier" and "hiring a developer". Start with one agent, measure hard, and scale. The ROI is proven in dozens of SME implementations.

Recommended for you

Related articles

Keep reading: articles that best match this topic in terms of content.

AI governance for SMEs: practical policy, roles and controls - AI governance is the set of rules, roles and controls your business uses to deploy AI responsibly. Learn which roles you need, how to set up controls and use our 10-point checklist.
24 mei 20266 min
AI governance for SMEs: practical policy, roles and controls
AI governance is the set of rules, roles and controls your business uses to deploy AI responsibly. Learn which roles you need, how to set up controls and use our 10-point checklist.
Read more
HR automation with AI: from recruitment to onboarding in SMBs - Discover how AI accelerates your HR processes: from CV screening and onboarding to leave management. Practical guide for SMEs.
17 mei 20266 min
HR automation with AI: from recruitment to onboarding in SMBs
Discover how AI accelerates your HR processes: from CV screening and onboarding to leave management. Practical guide for SMEs.
Read more
Build AI Workflows with Zapier, Make and n8n (No Coding Required) - You don't need to be a developer to build AI workflows. With Zapier, Make, and n8n, automate business processes in an afternoon.
13 mrt 20265 min
Build AI Workflows with Zapier, Make and n8n (No Coding Required)
You don't need to be a developer to build AI workflows. With Zapier, Make, and n8n, automate business processes in an afternoon.
Read more
5 Processes SMBs Automate with AI Agents - Which 5 processes do you automate as an SMB with AI agents? Invoicing, lead handling, customer service, reporting, and appointment scheduling—with concrete savings and implementation timelines.
23 feb 20267 min
5 Processes SMBs Automate with AI Agents
Which 5 processes do you automate as an SMB with AI agents? Invoicing, lead handling, customer service, reporting, and appointment scheduling—with concrete savings and implementation timelines.
Read more

Next step

From insight to implementation

This article explains how it works — we help SMEs to actually build it and connect it to your software.

Live in 2–6 weeks · Exact, AFAS, HubSpot