Skip to content
NEWMeet Alaaddin, your AI genie with a voice. trig8n launches 1 January 2027. See what is new

Library / Email Automation

Email Automation

Draft and label Gmail support and sales replies with OpenAI

Classifies each new Gmail message with OpenAI into support, sales, information, or other, then saves an AI-drafted reply as a Gmail draft for review.

What it does

# AI Email Automation -- Gmail + OpenAI Automatically classify incoming Gmail emails and prepare AI-generated replies as Gmail drafts for your review. ## How it works Gmail Trigger → Classify → AI Agent → Validate → Draft / Label 1. Gmail Trigger checks your inbox for new incoming emails. 2. Classification — each email is analyzed by AI and sorted into one of four categories: Support, Sales, Information, or Other. 3. Specialized AI Agent — a dedicated agent per category drafts a reply using the business information you provide in Manual Configuration. 4. Validation — the AI's output is checked against a structured schema (Subject + Body) before anything is created. 5. Draft & Label — a Gmail draft is created when appropriate, and the matching label is applied so you can find and review it easily. ### Human-in-the-loop Emails are never sent automatically. The workflow only prepares a draft — you always review, edit and send it yourself. ### Requirements - n8n instance - Gmail account (OAuth2) - OpenAI API key ### First steps 1. Open Manual Configuration and replace the example company information with your own. 2. Connect your Gmail and OpenAI credentials. 3. Make sure the required Gmail labels exist (see the Quick Start Checklist below). 4. Send yourself a test email for each category before activating the workflow. # ✅ Quick Start Checklist - [ ] Connect your Gmail OAuth2 credentials - [ ] Connect your OpenAI API credentials - [ ] Open Manual Configuration and fill in your real company information - [ ] Verify the required Gmail labels exist: Support, Sales, Information, Other, Error - [ ] Send yourself a test Support email and confirm a draft is created and labeled - [ ] Send yourself a test Sales email and confirm a draft is created and labeled - [ ] Send yourself a test Information email and confirm the agent only answers when it has enough information - [ ] Send yourself an unrelated email and confirm it's labeled Other with no draft - [ ] Review each generated draft for tone and accuracy before activating the workflow on real incoming emails # ⚠️ Important Notes - AI-generated replies are drafts only — nothing is ever sent automatically. - Draft quality depends entirely on how complete and accurate your Manual Configuration is. - Do not enter passwords, API keys or other sensitive credentials in Manual Configuration. - The Information Agent is instruct

The steps

  1. Create a draft: Support
  2. Create a draft: Information
  3. Output Parser
  4. Gmail Trigger
  5. Mail Classifier
  6. Support Agent
  7. Sales Agent
  8. Information Agent
  9. Apply Support Label
  10. Apply Sales Label
  11. Apply Info Label
  12. Apply Other Label
  13. Validate AI Response
  14. Validate AI Response 2

30 steps in total.

Similar automations