AI Email Triage and Auto-Reply
- Build an email triage workflow using the Gmail Trigger and Text Classifier
- Route emails to different branches based on AI classification using a Switch node
- Configure an AI Agent to draft support replies using a knowledge base tool
- Use the Information Extractor to capture structured lead data from sales emails
The Problem with Inboxes
Support inboxes are unpredictable: sales inquiries, bug reports, billing questions, and spam all arrive mixed together. Manually reading and sorting each email is slow and error-prone. An n8n workflow using lightweight AI nodes can read, classify, and route each incoming email — automatically — before any human needs to look at it.
The Workflow Architecture
This workflow combines lightweight AI nodes for classification with an AI Agent for drafting responses. The structure:
- Gmail Trigger — fires when a new email arrives in the monitored inbox.
- Text Classifier — classifies the email into one of four categories: Support, Sales, Spam, or Other.
- Switch node — routes the email to the correct branch based on the classification output.
- Support branch: AI Agent with a knowledge base tool → draft a reply → Gmail node (create draft or send).
- Sales branch: Information Extractor → extract contact details → HubSpot or Airtable node to create or update a lead record.
- Spam branch: Gmail node → mark as read and archive immediately.
- Other branch: Slack node → send a notification to a team channel for manual review.
Configuring the Text Classifier
Write clear, distinct category descriptions — the model uses these to handle edge cases correctly:
- Support — questions, problems, feature requests, or complaints about a product or service. Includes bug reports and how-to questions from existing customers.
- Sales — pricing inquiries, demo requests, partnership proposals, or messages from prospects who have not yet purchased.
- Spam — unsolicited commercial email, mass-sent messages, phishing attempts, or automated system notifications with no action required.
- Other — anything that does not clearly fit the above: press inquiries, job applications, personal messages.
Drafting Support Replies with the AI Agent
In the Support branch, configure an AI Agent with a system prompt designed for email drafting:
"You are a support agent for Acme Software. Read the customer's email and draft a helpful, professional reply. Search the knowledge base to find accurate answers. If you cannot resolve the issue, apologise and tell the customer a specialist will follow up within 24 hours. Keep replies under 200 words."
Connect the AI Agent to your Vector Store Tool (from the RAG lessons) so it can retrieve accurate answers before drafting. The email body from the Gmail Trigger feeds into the agent's input automatically.
Creating Drafts Before Auto-Sending
Start by creating email drafts rather than sending automatically. Configure the Gmail node to create a draft with the AI-generated reply. Review the drafts manually for the first week — this builds confidence in the system before switching to automatic sends. Most teams find they can switch to auto-send for common query types within two weeks of monitoring. Keep manual review for edge cases even after automation is running.
Extracting Lead Data for the CRM
In the Sales branch, add an Information Extractor node before the CRM update. Extract fields such as company_name, contact_email, product_interest, and budget_mentioned from the email body. Pass the structured output directly to the CRM node. This keeps lead records accurate without any manual data entry.
- The Text Classifier plus Switch node is the standard n8n pattern for email routing by content
- Start with creating drafts rather than auto-sending — review results before enabling full automation
- Detailed category descriptions for the Text Classifier improve accuracy on edge cases significantly
- The Information Extractor pulls structured CRM fields from email body text without any regex or parsing