How to Automate Customer Support With AI Agents
A practical walkthrough for building a zero-human support pipeline using Claude, n8n, and a shared inbox: handling 80% of tickets automatically for under $30/month.
A small SaaS founder recently posted that they were spending 12 hours a week answering the same 15 questions. Refund policy. How to reset a password. Whether the tool works on mobile. That is not customer support. That is copy-paste work that an agent can handle in milliseconds.
This tutorial shows you how to build a support pipeline that classifies incoming tickets, drafts responses for common issues, and escalates anything genuinely complex to a human. The setup runs on n8n, Claude via the Anthropic API, and any shared inbox that supports webhooks or IMAP polling. Total cost at low volume: under $30/month.
What the pipeline does
The finished system handles the full lifecycle of an inbound support ticket:
- Receives the email or form submission
- Classifies the issue into one of your predefined categories
- Checks a knowledge base (a plain Markdown file or Notion page) for the correct answer
- Drafts a response and sends it, or flags the ticket for human review if it falls below a confidence threshold
- Logs every ticket and outcome to a Google Sheet for auditing
No ticket queue UI. No dedicated support platform subscription. Just a workflow that runs continuously.
What you need
- n8n (self-hosted free, cloud starts at around €24/month)
- Anthropic API key (pay-as-you-go; at low volume this costs $2–5/month)
- An email inbox with webhook or IMAP access: Gmail works via IMAP, Postmark or Sendgrid work via webhook
- A knowledge base document: even a 500-word FAQ in plain text is enough to start
- A Google Sheet for logging (optional but recommended)
Step 1: Set up your knowledge base
Before writing a single workflow, write down every question your product receives and the correct answer to each. Be specific. Do not write "we have a generous refund policy." Write "we offer a full refund within 14 days of purchase, no questions asked. After 14 days, we do not issue refunds."
Save this as a plain text or Markdown file. Keep it somewhere your n8n instance can read it at runtime: a file on the server, a public Notion page fetched via API, or a Google Doc. The agent will receive this document in full as part of its context on every request, so keep it under 2,000 words to stay within a sensible token budget.
Step 2: Build the n8n workflow
In n8n, create a new workflow and add the following nodes in sequence:
Trigger node: Use the Gmail node (IMAP) set to poll every 5 minutes, or an Email Webhook node if your provider supports it. Filter to only trigger on emails sent to your support address.
HTTP Request node (fetch knowledge base): If your knowledge base is a remote file, add a node to fetch it. If it is local, use the Read Binary File node. Output the content as a string called kb_content.
Code node (build prompt): Construct the prompt you will send to Claude. Something like:
You are a customer support agent for [Product Name].
Your knowledge base:
---
{{kb_content}}
---
Customer email subject: {{subject}}
Customer email body: {{body}}
Classify this ticket into one of: REFUND, ACCOUNT, BUG, FEATURE_REQUEST, OTHER.
If you can answer it fully using the knowledge base, write a complete, polite reply in British English. Keep it under 120 words.
If you cannot answer it confidently, output ESCALATE and nothing else.
Respond in JSON: {"classification": "...", "response": "...", "escalate": true/false}
HTTP Request node (Claude API): POST to https://api.anthropic.com/v1/messages. Set the Authorization header to x-api-key: {{your_key}}, Content-Type to application/json. The body should pass your constructed prompt as a user message. Use claude-3-5-haiku-20241022 for speed and cost: it handles classification and short drafts well and costs roughly $0.001 per ticket.
IF node: Parse the JSON response. If escalate is true, route to the escalation branch. If false, route to the send branch.
Send branch, Gmail Send node: Reply to the original email using Claude's drafted response. Add a short footer: "This reply was drafted automatically. If something doesn't look right, reply and a human will follow up."
Escalation branch, Gmail Send node or Slack node: Forward the ticket to your personal inbox or a Slack channel with the classification and original message. You review and reply manually.
Google Sheets node (both branches): Log the ticket ID, classification, escalation status, and timestamp. This gives you an audit trail and, after a few weeks, the data to identify which categories need better knowledge base coverage.
Step 3: Handle edge cases
A few things will break without you planning for them:
Attachments: The basic setup ignores attachments. If your product receives bug reports with screenshots, add a note in the system prompt that the agent cannot view attachments and should escalate any ticket that mentions one.
Angry customers: Claude by default produces polite, neutral replies. If a ticket reads as hostile, the standard draft is fine, but you may want to route these to human review regardless. Add a check in your Code node: if the email body contains words like "lawyer", "chargeback", or "fraud", force escalate: true before even calling the API.
Loops: If a customer replies to the auto-response, your workflow will trigger again. Add a check for email thread depth or a subject-line tag to prevent the agent from responding to its own messages indefinitely.
Costs at scale
At 200 tickets/month, using Haiku at roughly $0.001 each, the API cost is $0.20. n8n cloud starts at around €24/month; self-hosted on a cheap VPS runs €5–10/month. Gmail is free. Total: around €25–35/month on cloud, under €15 self-hosted. At 2,000 tickets/month you are still under $40.
If you move to Claude Sonnet for more nuanced replies, expect costs around $0.01–0.02 per ticket, which at 2,000 tickets/month is $20–40 in API fees alone. Haiku is the right starting point. Move up only if you find the quality genuinely insufficient.
What this does not replace
This pipeline handles high-volume, repeatable queries well. It does not replace a human for anything that requires judgment about a specific customer's history, financial decisions above a certain threshold, or legal exposure. Build your escalation rules conservatively at first. After a month, look at your log and see what the agent got wrong. Tighten the knowledge base and adjust your confidence thresholds accordingly.
The goal is not zero human contact. The goal is no human contact for questions that do not require human judgment.
If you want to see more setups like this, Tim walks through live builds on YouTube and posts breakdowns in the AutonomousHQ newsletter. Both are free.