Skip to main content
Back to Blog
Productivity

n8n + Claude API: Complete Email and Task Automation Workflow for 2026

n8n is the open-source automation platform that connects your AI agents to every tool in your stack. Combined with the Claude API and a local LLM, it becomes a full AI automation layer for your personal and professional life.

SunlitHappiness Team
March 13, 2026
n8n + Claude API: Complete Email and Task Automation Workflow for 2026

n8n + Claude API: Complete Email and Task Automation Workflow for 2026

n8n is the open-source automation platform that lets you build the kind of workflows that used to require a dedicated engineering team. Combined with the Claude API and a local LLM backend, it becomes a full AI automation layer for your personal and professional life. Here's the complete setup—no experience required.

Why n8n Is the Right Automation Platform in 2026

The automation tool landscape in 2026 is crowded: Zapier, Make (formerly Integromat), Pipedream, Activepieces, and n8n compete for the same use cases. Here's why n8n wins for AI-powered automation:

Self-hosted and private: n8n runs on your own hardware ([Mac mini](/blog/mac-mini-m4-ai-agent-setup "Mac Mini M4 as a 24/7 AI Agent: The Complete Home Server Setup Guide for 2026"), VPS, home server). Your email content, task data, and AI prompts never pass through Zapier's servers.

AI-native architecture: n8n has first-class AI nodes—LangChain integration, vector store connections, agent loops, and direct API calls to Claude, GPT-4, Gemini, and local Ollama models.

No per-execution pricing: Zapier charges per task execution (2,000 tasks/month on the free plan; $30+/month for more). n8n self-hosted has zero marginal cost per execution.

Code flexibility: When no-code nodes aren't enough, drop into JavaScript or Python within the workflow. This eliminates the "ceiling" problem that limits Zapier power users.

Community: 400+ integrations, 50,000+ community workflow templates, active Discord.


Architecture: What We're Building

This guide builds a four-part AI automation system:

┌─────────────────────────────────────────────────────┐
│                    n8n Orchestration Layer           │
├─────────────────┬───────────────────────────────────┤
│  EMAIL AGENT    │  TASK AGENT                       │
│                 │                                   │
│ • Classify      │ • Create tasks from emails        │
│ • Summarize     │ • Priority scoring                │
│ • Draft replies │ • Daily planning brief            │
│ • Route to team │ • Deadline monitoring             │
├─────────────────┴───────────────────────────────────┤
│  AI BACKEND                                         │
│  Claude API (cloud) ←→ Ollama (local, private data) │
└─────────────────────────────────────────────────────┘

Private data → Ollama (local) Public/business research → Claude API (cloud, higher quality)


Part 1: Setting Up n8n with AI Credentials

Installation

# Via npm (recommended for Mac/Linux)
npm install -g n8n

Start n8n

n8n start

For Docker (more robust for server operation):

docker run -d \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  -e N8N_BASIC_AUTH_ACTIVE=true \
  -e N8N_BASIC_AUTH_USER=admin \
  -e N8N_BASIC_AUTH_PASSWORD=your_password \
  --restart unless-stopped \
  n8nio/n8n

Configuring API Credentials in n8n

In n8n Settings → Credentials, add:

Claude API:

  • Credential type: Anthropic API
  • API Key: your key from console.anthropic.com

Google (for Gmail, Calendar, Sheets):

  • Follow n8n's OAuth2 setup guide
  • Scopes: gmail.readonly, gmail.modify, calendar.readonly

Todoist or Linear (task manager):

  • API token from your task manager's settings

Notion (for database logging):

  • Notion integration token

Part 2: The Email Intelligence Workflow

This is the highest-value workflow for most knowledge workers. It runs every 15 minutes, processes your inbox with AI, and transforms how you experience email.

Workflow: Email Classification and Action Extraction

Trigger: Schedule (every 15 minutes) or Gmail webhook (instant)

Step 1: Fetch New Emails

Gmail node configuration:

Operation: Get Many
Filters:
  - UNREAD
  - After: {{ $now.minus({minutes: 20}).toISO() }}
  - Max results: 50

Step 2: Filter and Prepare

Function node to clean email data:

const emails = $input.all();
return emails.map(email => ({
  json: {
    id: email.json.id,
    from: email.json.from,
    subject: email.json.subject,
    snippet: email.json.snippet,
    date: email.json.date,
    // Don't send full body to AI—snippet is enough for classification
  }
}));

Step 3: AI Classification (Claude API)

Using n8n's Claude node or HTTP Request:

Model: claude-haiku-4-5  (fast, cheap, ideal for classification)
Temperature: 0
Max tokens: 150

System prompt: "You are an email classifier. Respond only with valid JSON."

User prompt: "Classify this email and extract any action items.

From: {{ $json.from }} Subject: {{ $json.subject }} Preview: {{ $json.snippet }}

Respond with this exact JSON structure: { "category": "URGENT|ACTION|READ|FYI|SUBSCRIBE|SPAM", "priority": 1-5, "action": "specific action required or null", "deadline": "deadline if mentioned or null", "reply_needed": true/false, "estimated_time": "minutes to handle or null" }"

Why claude-haiku for this step: Classification is a low-complexity task. Haiku processes it in 200–400ms at ~$0.001 per email. Running Sonnet on 100 emails would cost 20× more for identical output quality.

Step 4: Route by Category

Switch node routing:

  • URGENT → Apply Gmail label "!Urgent" + send push notification
  • ACTION → Create task in Todoist + apply "Action Required" label
  • READ → Apply "Read Later" label (batched for evening)
  • SUBSCRIBE → Apply "Newsletter" label
  • SPAM → Move to trash

Step 5: Create Tasks for ACTION Emails

For emails classified as ACTION:

Todoist node:
  Operation: Create Task
  Content: {{ $json.ai_response.action }}
  Due Date: {{ $json.ai_response.deadline || "today" }}
  Priority: {{ $json.ai_response.priority }}
  Description: "From email: {{ $json.subject }} ({{ $json.from }})"
  Labels: ["from-email"]

Step 6: Draft Reply (Optional)

For emails where reply_needed = true and category is ACTION or URGENT:

Model: claude-sonnet-4-6  (higher quality for reply drafts)
Temperature: 0.4

Prompt: "Draft a professional reply to this email.

Original email: From: {{ $json.from }} Subject: {{ $json.subject }} Body: {{ $json.body }}

Guidelines:

  • Match the formality of the original
  • Be concise (under 150 words unless complexity requires more)
  • If action is needed, confirm you'll handle it with a specific timeframe
  • Do not fabricate specific details or commitments not supported by context
  • End with [REVIEW BEFORE SENDING] as a reminder

Draft the reply only, no other commentary."

Save the draft to Gmail as a draft (Gmail node → Create Draft). You review and send manually—the AI handles the drafting cognitive load, you retain final judgment.


Part 3: The Task Intelligence Workflow

This workflow turns your raw task list into a daily prioritized action plan.

Workflow: Daily Planning Brief

Trigger: Schedule (7:00 AM daily)

Step 1: Gather Context

Run these in parallel:

Branch A: Todoist → Get tasks due today + overdue
Branch B: Google Calendar → Get today's events
Branch C: Gmail → Get unread URGENT/ACTION emails from last 12 hours
Branch D: Notion database → Get active projects and their status

Step 2: Merge and Structure

// Function node: Combine all context
const tasks = $('Todoist Tasks').all();
const events = $('Calendar Events').all();
const urgentEmails = $('Urgent Emails').all();
const projects = $('Active Projects').all();

const context = { tasks: tasks.map(t => ({ title: t.json.content, priority: t.json.priority, due: t.json.due, project: t.json.project_name })), meetings: events.map(e => ({ title: e.json.summary, time: e.json.start.dateTime, duration: e.json.duration, attendees: e.json.attendees?.length || 0 })), urgentEmails: urgentEmails.map(e => ({ from: e.json.from, subject: e.json.subject, action: e.json.ai_response?.action })), activeProjects: projects.map(p => ({ name: p.json.name, status: p.json.status, nextAction: p.json.next_action })) };

return [{ json: { context: JSON.stringify(context, null, 2) } }];

Step 3: AI Planning Brief

Model: claude-sonnet-4-6
Temperature: 0.2

Prompt: "You are a world-class chief of staff. Create a focused daily briefing.

Context: {{ $json.context }}

Deliver a briefing with these sections:

TODAY'S PRIORITY ORDER

List the top 5 actions for today, numbered by priority. For each:

  • Specific action (not just task name)
  • Estimated time
  • Why it's the priority (one phrase)

MEETINGS TO PREPARE FOR

For each meeting today: one sentence on what to be ready for

DECISIONS NEEDED

Any decisions required today before work can progress

DEFER OR DELEGATE

Tasks/emails that should be pushed or given to someone else

Keep the total briefing under 400 words. Be direct. No filler."

Step 4: Deliver

Send via three channels simultaneously:

  • ntfy.sh push notification (brief summary: top 3 priorities)
  • Email to yourself (full briefing for reference)
  • Notion daily log (stored for weekly review)

Part 4: The Meeting Intelligence Workflow

This workflow processes meeting recordings and generates structured outputs automatically.

Setup: Automatic Meeting Processing

When you finish a meeting on Zoom or Google Meet, the recording (or transcript if you use a tool like Read.ai, Otter.ai, or Granola) goes to a designated folder. n8n watches this folder and processes it.

Trigger: Watch Folder node (monitoring ~/Meetings/Inbox)

Processing pipeline:

[New file detected in ~/Meetings/Inbox]
        ↓
[If .mp3/.mp4: Transcribe via Whisper API or local whisper.cpp]
[If .txt/.md: Pass directly]
        ↓
[Claude API: Structure extraction]
  Prompt: "Analyze this meeting transcript and extract:

  1. DECISIONS MADE (bulleted, specific)
  2. ACTION ITEMS (owner, action, deadline)
  3. OPEN QUESTIONS (unresolved items needing follow-up)
  4. KEY CONTEXT (important information shared)
  5. NEXT STEPS (agreed follow-up meetings or milestones)

Format as structured JSON. Be specific and concise. Transcript: {{ $json.transcript }}" ↓ [Notion: Create meeting note with extracted structure] [Todoist: Create tasks for each action item with owner as label] [Gmail: Draft follow-up email to attendees with summary] [Move file to ~/Meetings/Processed/]

Time saved per meeting: Approximately 15–20 minutes of manual note organization per meeting, fully automated.


Part 5: Error Handling and Reliability

Automation that fails silently is worse than no automation—you lose trust in the system and have to double-check everything manually.

Error Notification Workflow

Attach to every workflow:

[Error Trigger: Catches any workflow error]
        ↓
[ntfy.sh: Push notification]
  "⚠️ Workflow failed: {{ $workflow.name }}
   Error: {{ $execution.error.message }}
   Time: {{ $now }}"
        ↓
[Notion: Log error with workflow name, error message, timestamp]

Rate Limiting for AI Calls

Claude API has rate limits. For bulk email processing, add a Wait node between AI calls:

[Loop: For each email]
  [Claude API call]
  [Wait: 0.5 seconds]
  [Process result]

For high-volume use cases (100+ emails/day), batch emails into groups of 5 and classify together:

Prompt: "Classify these {{ $json.emails.length }} emails.
Return a JSON array with one classification object per email.
Emails: {{ $json.emails }}"

Cost Optimization: Mixing Models by Task

Use the right model for each task to minimize cost without sacrificing quality:

TaskModelWhy
Email classificationclaude-haiku-4-5Simple classification; speed and cost matter
Task extraction from emailclaude-haiku-4-5Structured output, low complexity
Daily planning briefclaude-sonnet-4-6Reasoning and synthesis; quality matters
Reply draftingclaude-sonnet-4-6Tone and nuance; quality matters
Meeting processingclaude-sonnet-4-6Complex comprehension
Private data (local)Ollama llama3.3Privacy; zero marginal cost

Typical monthly API cost for a knowledge worker processing 50 emails/day + 2 meeting summaries + 1 daily brief: $8–15/month with smart model selection.


Workflow Templates: Download and Import

The n8n community template library contains ready-to-use workflows for all the patterns in this guide. Search for:

  • "Email classification AI"
  • "Daily briefing automation"
  • "Meeting summary Claude"
  • "Todoist AI prioritization"

Import via Settings → Import Workflow in n8n's interface.


The Compounding Value of Automation

The most important thing about n8n + AI automation isn't any individual workflow. It's the compounding effect.

Each workflow you build:

  1. Eliminates a recurring cognitive task
  2. Creates structured data (in Notion, Todoist, or a database)
  3. That structured data enables better AI decisions in future workflows
  4. Better AI decisions further reduce manual overhead

After 6 months of running these workflows, you'll have:

  • A searchable database of every email, task, meeting, and document processed through your system
  • AI models that have "seen" your patterns and make better routing decisions
  • A clear picture of where your time actually goes vs. where you want it to go

The setup takes a weekend. The returns compound for years.

Tags

#n8n#Claude API#email automation#task automation#AI workflow#Ollama#no-code automation#productivity automation

SunlitHappiness Team

Our team synthesizes insights from leading health experts, bestselling books, and established research to bring you practical strategies for better health and happiness. All content is based on proven principles from respected authorities in each field.

Join Your Happiness Journey

Join thousands of readers getting science-backed tips for better health and happiness.

Related Articles