How to Use n8n for AI Automation in 2026 — Beginner's Guide
Learn how to use n8n to build AI automation workflows — from simple email triggers to multi-step AI agents. Practical examples with real workflow templates.
n8n scored 82/100 in our testing. It's an open-source workflow automation tool that connects apps, APIs, and AI models without writing full backend code. Think Zapier but with actual code control — and a free self-hosted option.
Here's how to start building AI automations with it.
n8n vs Zapier vs Make: When to Choose n8n
| n8n | Zapier | Make | |
|---|---|---|---|
| Self-hosted | ✅ Free | ❌ | ❌ |
| AI/LLM nodes | ✅ Native | Limited | Limited |
| Custom code | ✅ JavaScript | Limited | Limited |
| Price (cloud) | $20/mo | $49/mo+ | $9/mo+ |
| Learning curve | Medium | Easy | Medium |
Choose n8n if you need: AI model integration, self-hosting for data privacy, custom code in workflows, or complex branching logic.
Getting Started: Cloud vs Self-Hosted
Option 1: n8n Cloud (Fastest)
- Sign up at n8n.io
- Choose a workspace — the free trial includes full feature access
- You're building in 2 minutes
Option 2: Self-Hosted (Free, More Control)
npx n8n
Or with Docker:
docker run -it --rm --name n8n -p 5678:5678 n8nio/n8n
Access at localhost:5678.
Self-hosted is free forever and keeps your data local — important for workflows handling sensitive information.
Understanding n8n's Interface
Every n8n workflow is a visual graph:
- Nodes: Individual steps (trigger, action, transformation)
- Connections: Arrows linking nodes — data flows along these
- Trigger node: Always the first node — starts the workflow
- Canvas: The visual editor where you build
Click + to add a node. Search by app name (Gmail, Slack, OpenAI) or function (HTTP Request, Code, Merge).
Your First AI Workflow: Email → AI Summary → Slack
This workflow reads new emails, summarizes them with AI, and posts to Slack.
Step 1: Gmail Trigger
- Add node → search Gmail Trigger
- Set trigger: New Email
- Connect your Google account via OAuth
- Set polling interval: every 5 minutes
Step 2: OpenAI Node
- Add node → search OpenAI
- Operation: Message a Model
- Model:
gpt-4o-mini(fast and cheap for summaries) - Prompt:
Summarize this email in 2-3 bullet points. Note the sender, key request or information, and any action required.
Email:
{{ $json.snippet }}
The {{ $json.snippet }} references the email text from the previous node.
Step 3: Slack Node
- Add node → search Slack
- Operation: Send a Message
- Channel: your target channel
- Message:
📧 New email from {{ $('Gmail Trigger').first().json.from }}
{{ $json.message.content }}
- Connect Slack via OAuth
Test and Activate
- Click Test Workflow to run with a real email
- Check each node's output in the execution panel
- Fix any errors (usually OAuth or missing field references)
- Click Activate to run on the schedule
3 High-Value AI Automation Workflows
Workflow 1: AI Content Repurposing
Trigger: RSS feed (new blog post published) Step 1: HTTP Request → fetch the article content Step 2: OpenAI → generate LinkedIn post, X thread, and email newsletter excerpt Step 3: Google Sheets → log content to a tracker Step 4: Slack → notify team with the generated content for review
Workflow 2: Customer Support Triage
Trigger: Gmail/Help desk (new support email) Step 1: OpenAI → classify urgency (urgent/normal/low) and category (billing/technical/general) Step 2: Code node → route based on classification Step 3 (urgent): Slack → immediate alert to support team Step 3 (normal): Add to support queue in Notion/Airtable Step 4: Gmail → send acknowledgment email with estimated response time
Workflow 3: AI Research Assistant
Trigger: Google Sheets (new row with research topic) Step 1: HTTP Request → Perplexity API (search the web for the topic) Step 2: OpenAI → summarize findings and identify gaps Step 3: Google Docs → create a research brief document Step 4: Gmail → email the brief to the requester
The Code Node: Where n8n Gets Powerful
The Code node lets you write JavaScript to transform data between steps:
// Example: format an array of items into a readable list
const items = $input.all();
return items.map(item => ({
json: {
formatted: `• ${item.json.title}: ${item.json.description}`,
timestamp: new Date().toISOString()
}
}));
This is what separates n8n from Zapier — you can do anything with data, not just map fields.
Connecting AI Models
n8n supports these AI integrations natively:
- OpenAI: GPT-4o, GPT-4o-mini, Whisper, DALL-E
- Anthropic: Claude 3.5 Sonnet, Claude Haiku
- Google: Gemini 1.5 Pro/Flash
- Ollama: Local models (self-hosted only)
- HTTP Request: Any AI API with a REST endpoint
For complex AI chains (multi-step reasoning, tool use), use the AI Agent node — it handles tool calling and multi-step workflows automatically.
See also: n8n review → | Make review → | Best automation tools →
Frequently Asked Questions
Is n8n free to use?
n8n is free to self-host — you can run it on your own server with no usage limits at zero cost. The cloud version starts at $20/mo. For most users starting with automation, the self-hosted version (running via npm or Docker) is free and gives full access to all features including AI integrations.
Is n8n better than Zapier?
n8n (82/100) offers more flexibility than Zapier — self-hosting for free, native AI model nodes, and a JavaScript code node for custom logic. Zapier is easier for non-technical users and has more pre-built app integrations. For AI automation workflows and developers who want code control, n8n is the better choice. For quick no-code automations without complexity, Zapier is faster to get started.
What can you build with n8n?
Common n8n use cases include: AI email management (summarize, classify, respond), content repurposing (blog → social media), customer support triage, data pipelines between business tools, website monitoring and alerts, and multi-step AI agents. n8n connects 400+ apps and any REST API, so almost any automation between tools is possible.
How hard is n8n to learn?
n8n has a medium learning curve. The visual workflow builder is intuitive — drag nodes, connect them, configure. The complexity comes from data mapping (referencing values from previous nodes using expressions) and debugging. Most users are building basic automations within an hour. Complex AI agent workflows take a day of learning. n8n's documentation and community templates significantly reduce the learning time.