This article contains affiliate links. If you buy through them, we may earn a commission at no extra cost to you.
Stop Answering the Same Customer Emails Every Day
If your inbox is full of repetitive questions — order status, return policies, pricing, business hours — you're spending hours every week on work that an AI can handle in seconds. The good news: you don't need to hire a developer or buy expensive software to fix this.
In this guide, you'll build a working AI customer service agent using n8n paired with Anthropic's Claude. The agent will monitor an inbox, understand what customers are asking, and send intelligent, context-aware replies automatically.
What You'll Build
By the end of this tutorial, your workflow will:
- Trigger when a new customer email arrives
- Extract the customer's question and intent
- Send the message to Claude for a natural-language response
- Reply to the customer automatically from your email address
- Log the interaction for your records
This entire system runs without any code and can be live within an afternoon.
What You Need Before You Start
- An n8n account (Cloud or self-hosted)
- An Anthropic API key (available at console.anthropic.com)
- A Gmail or IMAP-connected email address
- A Google Sheet or Airtable base for logging (optional but recommended)
Step-by-Step: Building the Workflow
Step 1 — Trigger on New Email
Open n8n and create a new workflow. Add a Gmail Trigger node (or IMAP if you use a different provider). Set it to poll your inbox every 5 minutes and filter for unread messages. This becomes the starting point of every automated response.
Step 2 — Extract and Clean the Email Content
Add a Set node to pull out the fields you need: sender name, sender email, subject line, and body text. Use an expression like {{ $json.text }} to grab the plain-text body. Strip out signatures and quoted history using a simple Function node with a regex — this keeps the input to Claude clean and focused.
Step 3 — Send the Message to Claude
Add an HTTP Request node and point it to the Anthropic API endpoint: https://api.anthropic.com/v1/messages. In the headers, include your API key and set the content type to JSON. In the body, build a prompt like this:
System prompt: