n8n is the open-source workflow automation platform that has quietly become the go-to choice for developers who want Zapier-level convenience without vendor lock-in. In 2026, its built-in AI nodes — combined with direct API access to Claude, GPT-4o, and Gemini — make it possible to build genuinely intelligent workflows: email summarizers, Slack Q&A bots, customer feedback classifiers, and multi-tool agents that plan and act autonomously. This guide walks you through each pattern from a running n8n instance to a production AI agent, with no application code required.
What is n8n?
n8n (pronounced n-eight-n) is a fair-code licensed workflow automation tool. Like Zapier or Make (formerly Integromat), it connects apps and services through a visual canvas. Unlike them, you can self-host it for free, write custom JavaScript or Python in Code nodes, and call any HTTP API directly — including LLM providers.
The core concepts you need:
- Nodes — individual steps in a workflow. Each node does one thing: trigger on a Gmail message, call an HTTP endpoint, write to a Google Sheet, send a Slack message.
- Workflows — a directed graph of nodes connected by edges. Data flows as JSON between nodes.
- Triggers — the node that starts a workflow. Triggers can be a webhook, a schedule (cron), an app event (new email, new row), or a manual run.
- Credentials — stored API keys and OAuth tokens. You configure them once and reference them in any node.
- Expressions —
{{ $json.fieldName }}syntax to reference data from previous nodes anywhere in the canvas.
n8n Cloud (hosted, paid from $20/month) is the fastest way to start. Self-hosting with Docker is free and takes under five minutes — and gives you full control over your data, which matters when you are passing sensitive documents through AI nodes. The codebase is released under a fair-code license: free to self-host for individuals and small teams, with a paid plan required for larger commercial deployments.
Setting Up n8n with Docker
The quickest self-hosted setup uses Docker Compose. Create a docker-compose.yml file and run docker compose up -d:
version: "3.8"
services:
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=changeme
- WEBHOOK_URL=http://localhost:5678/
- GENERIC_TIMEZONE=Europe/Kyiv
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:Open http://localhost:5678 in your browser, create an owner account, and you are in the canvas. The n8n_data volume persists all workflows, credentials, and execution history across container restarts. For production, replace localhost with your domain, add an SSL reverse proxy (Caddy or Nginx), and set a strong password.
To give workflows access to LLMs, store your API keys in Settings → Credentials. n8n encrypts them at rest and injects them into nodes at runtime — your keys never appear in plain text inside workflow definitions.
Your First AI Workflow: Email Summarizer
This workflow reads incoming emails, summarises each one with Claude, and sends the summary as a reply — a genuine time-saver for high-volume inboxes. The entire workflow is three nodes:
- Gmail Trigger node — set to On Message Received, filtered to a specific label (e.g. needs-summary). Each new email fires the workflow and passes subject, sender, and body as
$json. - HTTP Request node (Claude API) — method POST, URL
https://api.anthropic.com/v1/messages. In Headers addx-api-key(your Anthropic key stored as a Header Auth credential) andanthropic-version: 2023-06-01. Body (JSON):{"model": "claude-sonnet-4-6", "max_tokens": 256, "messages": [{"role": "user", "content": "Summarise this email in 3 bullet points:\n{{ $json.text }}"}]}. The reply lands incontent[0].text. - Gmail node (Reply) — set to Reply to Message, using
{{ $('Gmail Trigger').item.json.id }}as the thread ID. Set the message body to{{ $json.content[0].text }}.
Connect the three nodes left-to-right, activate the workflow with the toggle in the top bar, and send a test email to your watched label. The summary reply arrives within seconds. This same three-node pattern is the foundation for every AI workflow in this guide — swap the trigger and the output node to adapt it to any app.
Calling Claude API in n8n
n8n ships with a built-in Anthropic node (available from n8n v1.30+). For more control — custom headers, extended thinking, or any beta features — use the HTTP Request node instead. Here is the exact configuration:
- Method: POST
- URL:
https://api.anthropic.com/v1/messages - Header — x-api-key: your Anthropic API key (store in n8n Credentials → Header Auth, never paste raw)
- Header — anthropic-version:
2023-06-01 - Header — content-type:
application/json - Body (JSON):
{"model": "claude-sonnet-4-6", "max_tokens": 1024, "messages": [{"role": "user", "content": "{{ $json.prompt }}"}]}
The response lands in the next node as $json.content[0].text. Reference it downstream with {{ $('HTTP Request').item.json.content[0].text }}. To pass dynamic content from earlier nodes, use n8n’s expression syntax: {{ $('Node Name').item.json.fieldName }}. For structured output, ask Claude to reply in JSON and parse it with a Code node.
For a step-by-step walkthrough of n8n workflows that use Claude tool use, vision, and extended thinking, see the n8n Claude Automation Guide.
Build a Slack AI Bot
A Slack Q&A bot that answers team questions using Claude requires four nodes in n8n and stays within the free self-hosted tier regardless of message volume:
- Slack Trigger node — event: Message Posted to Channel, restricted to
#ask-ai. The node outputstext(the message content) andchannel(the channel ID for the reply). - IF node — condition:
{{ $json.bot_id }}is empty. This prevents reply loops by skipping messages posted by bots, including n8n’s own replies. True branch continues; false branch ends the workflow. - HTTP Request node (Claude) — call Claude with the prompt:
You are a helpful team assistant. Answer this question concisely: {{ $('Slack Trigger').item.json.text }}. - Slack node (Post Message) — action Post Message, channel:
{{ $('Slack Trigger').item.json.channel }}, text:{{ $('HTTP Request').item.json.content[0].text }}. Enable Reply in Thread and pass{{ $('Slack Trigger').item.json.ts }}as the thread timestamp to keep conversations organised.
To make the bot knowledgeable about your team’s documentation, add a Code node between the IF and the HTTP Request node. Use it to fetch relevant chunks from a vector database (Pinecone, Qdrant, or Chroma) and append them to the Claude prompt as context. This is a five-node RAG pipeline with zero application code.
AI Data Processing Pipeline
This pattern handles a common data engineering task: receive raw JSON from an external source, classify and extract structured fields with Claude, and write clean rows to a spreadsheet. The use case here is classifying customer feedback from a webhook.
- Webhook node — creates a unique POST URL. Configure your form tool to submit feedback here. Each submission triggers the workflow with fields:
customer_id,message,rating. - Code node (JavaScript) — validate and normalise the payload. Trim whitespace, reject submissions shorter than 10 characters, and default missing fields.
- HTTP Request node (Claude Classify) — prompt:
Classify this customer feedback into exactly one category: BUG, FEATURE_REQUEST, COMPLAINT, PRAISE, or OTHER. Also extract the product area mentioned (one word). Respond with JSON only: {"category": "...", "product_area": "..."}.\n\nFeedback: {{ $json.message }}. - Switch node — route on the category string: BUG → Jira Create Issue; COMPLAINT → Zendesk Ticket; PRAISE → Slack node posting to
#wins; everything else → catch-all email node. - Google Sheets node (Append) — log every item regardless of routing: timestamp, customer_id, message, rating, category, product_area.
Run this workflow against a backlog of 500 feedback entries using the Bulk Run feature and you have a classified, structured dataset ready for analysis in minutes. Swap the simple classification prompt for a richer one to extract sentiment score, urgency level, and affected feature in a single Claude call.
n8n AI Agent (2026)
n8n’s AI Agent node (stable since v1.35) implements the plan-act-observe loop natively. You give the agent a goal and a set of tools; it decides which tools to call, observes the results, and repeats until it reaches a final answer — all without you writing orchestration logic.
How the agent loop works in n8n:
- Plan — Claude receives the user’s goal and the descriptions of every available tool. It outputs a structured tool call specifying which tool to invoke and with what arguments.
- Act — n8n executes the tool call (HTTP request, web search, code execution, database lookup) and captures the result.
- Observe — the tool result is appended to the conversation context and sent back to Claude as a tool message.
- Repeat — Claude decides whether to call another tool or output a final answer. n8n loops automatically up to a configurable iteration limit (default: 10).
To build an agent: add an AI Agent node, connect it to a Chat Trigger for interactive testing, set the LLM to your Anthropic credential with claude-sonnet-4-6, and attach tool sub-workflows. Common tools to wire in: Web Search (SerpAPI or Tavily node), HTTP Request (call any internal API), Calculator (built-in), and Google Calendar (read availability, create events).
Practical 2026 use cases: competitive research agents that summarise a list of competitor URLs, automated report generators that pull live data and write structured summaries, code review bots that fetch GitHub PRs and critique them, and customer support agents that look up order history before composing a reply.
n8n vs Zapier vs Make
All three platforms connect apps and automate workflows, but they differ significantly on pricing, AI capabilities, and flexibility:
- Pricing — n8n: free self-hosted (unlimited executions and workflows), cloud from $24/month; Zapier: free tier limited to 100 tasks/month, paid from $20+/month (task-based billing); Make: free tier (1,000 operations/month), paid from $9+/month (operation-based billing)
- AI nodes — n8n: native Agent node, Anthropic/OpenAI/Gemini nodes, LangChain integration, vector store nodes, HTTP Request covers every other LLM API; Zapier: AI Actions (OpenAI only, limited); Make: OpenAI module (limited, no native agent loop)
- Self-hosting — n8n: full Docker and Kubernetes support, open-source codebase; Zapier: cloud-only; Make: cloud-only
- Code execution — n8n: JavaScript and Python Code nodes with full npm/PyPI access; Zapier: Code by Zapier (limited JavaScript environment); Make: no general code node
- Workflow complexity — n8n: unlimited branching, loops, sub-workflows, and error handling workflows; Zapier: linear by default, Paths add branching on paid plans; Make: strong visual routing with scenarios
- Integration breadth — n8n: 400+ native integrations, HTTP Request covers every REST API; Zapier: 6,000+ native integrations; Make: 1,600+ integrations
For AI-heavy workflows, self-hosting requirements, or developer-first teams, n8n is the clear choice in 2026. For maximum integration breadth with minimal setup, Zapier still leads. Make is a strong middle ground for non-developers who need complex branching without writing code.
Best Practices
- Error Trigger node — create a dedicated error-handling workflow. The Error Trigger fires whenever any other workflow throws an unhandled exception. Wire it to a Slack alert or a Google Sheets log that captures the workflow name, node name, and full error message.
- Wait node for rate limiting — insert a Wait node between LLM API calls when processing batches. A 1–2 second delay stays within Anthropic’s rate limits and avoids 429 errors on large payloads.
- Manual Trigger for testing — build and debug with a Manual Trigger node. Once the workflow is stable, add the production trigger (Webhook, Schedule, Gmail) alongside it without restructuring the rest of the flow.
- Split In Batches node — when processing lists (e.g. 500 emails), split into batches of 10–50 items. Memory stays low and a mid-batch failure only loses the current batch, not the entire run.
- Pin data for development — right-click any node’s output and pin it. Subsequent test runs replay the pinned data instead of calling live APIs, saving quota and making tests deterministic.
- Prompt versioning — store system prompts in n8n Variables (Settings → Variables) or a reference Google Sheet, not hardcoded inside node parameter fields. This lets you update prompts without editing the workflow graph.
- Credential scoping — always store API keys in n8n Credentials. Never paste keys into expression fields or Code nodes. Set
N8N_ENCRYPTION_KEYin production and back up the.n8nvolume.
Summary
- n8n is a self-hostable, fair-code automation platform with native AI Agent, Anthropic, and OpenAI nodes — ideal for developer-built AI automations
- A Docker Compose setup has you running on port 5678 in under five minutes; n8n Cloud is the managed alternative
- The email summariser, Slack bot, and data pipeline patterns all follow the same three-to-five node structure: trigger → Claude API call → output node
- The AI Agent node implements the plan-act-observe loop natively — wire in tools and let Claude decide when and how to use them
- n8n beats Zapier and Make on AI depth, self-hosting freedom, and code execution; Zapier leads on raw integration count
- Error Trigger, Wait, and Split In Batches are the three nodes that make AI workflows production-ready
Further reading: How to Build an AI Agent in Python — the same agent loop implemented in code; Multi-Agent Systems with LLMs — architectures for coordinating multiple AI agents in production.
Subscribe to my newsletter — practical guides on Claude API, AI agents, RAG, and automation.