Gmail Email Management and AI Auto-Response System - n8n Workflow

Automate Gmail email sorting, AI classification, drafting, and logging to Google Sheets using this powerful n8n workflow. Integrate GPT-4o for smarter email handling.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Professionals receiving high volumes of email who need immediate prioritization.

  • Users looking for advanced Gmail automation using AI services like OpenAI.

  • Technical users seeking comprehensive n8n templates for business operations.

  • Administrators who need to log specific email types (like advertisements or finance notices) to a structured Google Sheet.

Overview

This robust n8n workflow revolutionizes email management by implementing an AI-driven triage system. Instead of manually sorting your inbox, this n8n automation template leverages the power of LangChain's Text Classifier and various OpenAI models (like GPT-4o) to instantly categorize every incoming message into High Priority, Advertisement, Inquiry, or Finance/Billing. The value of this n8n solution lies in its ability to execute intelligent, category-specific actions immediately—from creating AI-generated draft replies for urgent matters to automatically summarizing and logging low-priority promotional content to a Google Sheet. This sophisticated n8n node structure ensures that crucial emails are never missed, saving significant time and improving response efficiency across all communication channels. Every component utilizes a dedicated n8n node optimized for its task.

How it Works

This comprehensive n8n workflow begins with the Gmail n8n trigger, which monitors the inbox for new emails.


  1. Trigger & Classification: The process starts when the Gmail n8n trigger fires upon receiving a new email. The email content is immediately passed to the LangChain Text Classifier n8n node, which uses detailed category descriptions to classify the message into one of four types (Priority, Ad, Inquiry, Finance).

  2. Priority Handling (Drafting): If classified as "High Priority," the Gmail n8n node applies a corresponding label. A dedicated OpenAI n8n node (GPT-4o) generates a detailed, executive-level draft reply. This draft is then saved directly back into Gmail using another Gmail n8n node, ready for final review and sending.

  3. Advertisement Handling (Logging): For "Advertisement" emails, the Gmail n8n node labels the message. An OpenAI n8n node summarizes the email content, extracting key fields like Sender, Subject, and Recommendation. This structured summary is then appended as a new row in a Google Sheets document via the Google Sheets n8n node.

  4. Inquiry Handling (Auto-Reply): "Inquiry" emails are labeled, and an OpenAI n8n node generates a polite, customer service-focused response, including a fallback contact number. The workflow uses a Gmail n8n node to automatically reply directly to the original inquiry thread.

  5. Finance/Billing Handling (Sending Summary): "Finance/Billing" emails are labeled, and the content is processed by an OpenAI n8n node to generate a concise summary. This summary is then sent as a new email (using a Gmail n8n node) to a designated finance recipient for immediate administrative action. This entire automation is a prime example of effective, multi-step n8n templates.

Installation Guide


  1. Importing the n8n workflow: Copy the provided JSON data and paste it directly into your n8n instance using the "New" button and selecting "Import from JSON."

  2. Credential Setup: You will need to configure three primary credentials:

Gmail OAuth2: Connect your primary Gmail account used by the n8n trigger and subsequent response nodes.
OpenAI API: Provide your API key for the OpenAI n8n node. Ensure the connected account has access to the GPT models specified (e.g., gpt-4o).
Google Sheets OAuth2: Connect the account with write access to the target summary spreadsheet.

  1. Customization:

In the Gmail n8n nodes (e.g., Save Priority Mail), update the placeholder labelIds to match the custom labels you have created in your Gmail account (e.g., "AI-Priority").
Update the Append Row to Sheet n8n node with your specific Google Sheet Document ID and Sheet Name.
In the final Gmail n8n node for Finance/Billing (Reply to Inquiry), replace the placeholder {{YOUREMAILADDRESS}} with the actual email address where finance summaries should be sent. This specific n8n node handles forwarding.

  1. Activation: After setting up credentials and customization, activate the n8n workflow to start monitoring your inbox using the Gmail n8n trigger.

Node Details

Gmail Trigger (n8n trigger): This essential starting n8n node polls your Gmail inbox for new emails every minute. It initiates the entire n8n workflow when a new message is detected.
Text Classifier (LangChain n8n node): Takes the raw email body ($json.text) and uses LangChain capabilities combined with an OpenAI model to accurately classify the message into one of four detailed categories, determining the path of the n8n workflow.
Gmail (n8n node - Save Mail): Four separate instances of this n8n node are used across the branches to apply a specific, pre-defined label to the original email (operation is addLabels), ensuring the inbox remains organized.
OpenAI (n8n node - Generate Draft/Summary/Reply): Multiple instances of this powerful n8n node (utilizing GPT-4o) handle all the heavy lifting. Custom prompts are used to generate a detailed reply draft (Priority), extract a structured summary (Advertisement), or compose a customer auto-response (Inquiry).
Google Sheets (n8n node - Append Row to Sheet): Used in the Advertisement branch. This n8n node maps the structured JSON output from the AI summary directly into predefined columns in the target Google Sheet.
Gmail (n8n node - Create Draft / Reply): These final Gmail n8n nodes handle the outgoing communication, utilizing the AI-generated text to either create a draft or reply to an existing email thread.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by
Haruki Kuwai
Haruki Kuwai

HI

Featured*