\n\n\n

How to Build an AI Customer Service Agent with n8n and Claude

Learn how to build an AI-powered customer service agent using n8n and Claude that automatically reads, understands, and replies to customer emails — no developer needed.

← All Articles
🇬🇧 English

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:

🇩🇪 Deutsch

Dieser Artikel enthält Affiliate-Links (Werbung). Kaufst du darüber, erhalten wir ggf. eine Provision – für dich ohne Mehrkosten.

Schluss mit den immer gleichen Kundenanfragen

Wenn dein Posteingang täglich mit denselben Fragen geflutet wird – Bestellstatus, Rückgabebedingungen, Preise, Öffnungszeiten – verlierst du jede Woche Stunden für Aufgaben, die eine KI in Sekunden erledigen kann. Das Gute: Du brauchst weder einen Entwickler noch teure Software, um das zu ändern.

In dieser Schritt-für-Schritt-Anleitung baust du einen funktionierenden KI-Kundenservice-Agenten mit n8n und Anthropics Claude. Der Agent überwacht deinen Posteingang, versteht Kundenanfragen und beantwortet sie automatisch – intelligent und kontextbezogen.

Was du am Ende haben wirst

Nach diesem Tutorial erledigt dein Workflow folgendes automatisch:

  • Erkennt neue Kunden-E-Mails im Posteingang
  • Liest die Frage aus und erkennt die Absicht des Kunden
  • Sendet die Nachricht an Claude für eine natürliche Antwort
  • Antwortet dem Kunden automatisch von deiner E-Mail-Adresse
  • Protokolliert jede Interaktion zur Nachverfolgung

Das gesamte System funktioniert ohne Code und kann noch am selben Nachmittag live gehen.

Voraussetzungen

  • Ein n8n-Account (Cloud oder selbst gehostet)
  • Ein Anthropic API-Schlüssel (erhältlich unter console.anthropic.com)
  • Eine Gmail- oder IMAP-verbundene E-Mail-Adresse
  • Google Sheets oder Airtable zum Protokollieren (optional, aber empfohlen)

Schritt für Schritt: Den Workflow bauen

Schritt 1 — Trigger bei neuer E-Mail

Öffne n8n und erstelle einen neuen Workflow. Füge einen Gmail Trigger-Node hinzu (oder IMAP für andere Anbieter). Stelle ihn so ein, dass er alle 5 Minuten deinen Posteingang auf ungelesene Nachrichten prüft. Das ist der Startpunkt jeder automatischen Antwort.

Schritt 2 — E-Mail-Inhalt extrahieren und bereinigen

Füge einen Set-Node hinzu und extrahiere die benötigten Felder: Absendername, Absender-E-Mail, Betreff und Nachrichtentext. Nutze einen Ausdruck wie {{ $json.text }} für den Klartext. Entferne mit einem Function-Node per Regex Signaturen und zitierte Vorgängernachrichten – so bleibt die Eingabe für Claude sauber und präzise.

Schritt 3 — Nachricht an Claude senden

Füge einen HTTP Request-Node hinzu und richte ihn auf den Anthropic-API-Endpunkt: https://api.anthropic.com/v1/messages. Trage in den Headers deinen API-Schlüssel ein und setze den Content-Type auf JSON. Im Body baust du einen Prompt wie diesen:

System-Prompt: „Du bist ein freundlicher Kundenservice-Mitarbeiter für [dein Unternehmensname]. Beantworte Fragen zu unseren Produkten, Rückgaben und Versand. Halte Antworten unter 150 Wörtern. Wenn du eine Frage nicht beantworten kannst, sage das höflich und biete an, weiterzuleiten.

Ready to automate?

Automatisierung ohne Entwickler.

Fertige n8n Workflows für KMU — sofort einsatzbereit.

Zu den Templates →