AI Email Assistant for Smart Inbox Classification and Auto-Drafting - n8n Workflow

Automate your Gmail inbox with this powerful n8n workflow. Use GPT-4 for smart classification, urgent alerts, auto-drafting responses, and Google Drive attachment management.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Users seeking to implement robust email AI solutions.

  • Small business owners and executives overwhelmed by high inbox volume.

  • Automation specialists looking for advanced n8n templates integrating Langchain and Gmail.

  • Professionals needing instant, AI-driven alerts for urgent communications.

  • Teams aiming to standardize email processing and categorization using an n8n node approach.

Overview

Managing a high-volume inbox can be time-consuming and error-prone. This sophisticated n8n workflow solves this by deploying a powerful AI Email Assistant capable of smart triage and action execution. Starting with an n8n trigger on new Gmail messages, the automation uses context-aware processing to classify emails based on urgency, required action, and category.

It dynamically syncs with your custom Gmail labels, ensuring the AI classification is always relevant. Depending on the analysis, the n8n workflow can draft responses, upload attachments to Google Drive with duplicate checks, send urgent alerts via Telegram, and apply precise labels. This complex n8n template significantly reduces manual email management time, allowing users to focus only on communications that require personalized attention.

How it Works

The process begins when a new email is received, activating the Email_Trigger (Gmail n8n trigger).


  1. Context Retrieval: The n8n workflow fetches the full conversation thread to maintain context, essential for accurate AI assessment.

  2. Label Synchronization: The system dynamically retrieves all user-defined Gmail labels. This information is passed to the LLM to ensure classification uses current, relevant categories.

  3. AI Classification: The AI Email Classifier (an n8n node using GPT-4o-mini) analyzes the email content against strict rules and generates a structured JSON output defining the email's priority, response requirement, and attachment needs.

  4. Action Routing: The Smart Action Router n8n node directs the flow into parallel processing paths based on the AI's classification.

  5. Drafting: If a response is required, the AI Response Generator creates a professional draft, which is saved back to the Gmail thread via a dedicated n8n node, awaiting user review.

  6. Attachment Handling: If attachments are present, the n8n workflow checks Google Drive for duplicates using a standardized naming convention before uploading the file.

  7. Alerting & Labeling: If the email is flagged as urgent, an alert is sent via Telegram. Finally, appropriate classification labels (determined by the AI) and a 'Processed' label are applied to the original message using Gmail n8n nodes, completing the n8n workflow execution.

Installation Guide


  1. Import: Download the provided n8n workflow JSON file and import it into your n8n instance.

  2. Credentials: You will need three main credentials configured:

Gmail: Set up a Gmail credential for the EmailTrigger and all subsequent Gmail n8n nodes.
OpenAI/LLM: Configure an appropriate credential for the Langchain n8n node (AI Language Model).
Google Drive: Set up a credential for the file upload nodes.
Telegram: Set up a Telegram credential for the Send Urgent Alert n8n node (optional).

  1. Configuration: Replace all placeholder values marked with YOUR... in the following nodes:

Upload to Google Drive: Update YOURGOOGLEDRIVEFOLDERID.
Mark as Processed: Update YOURPROCESSEDLABELID with the Gmail ID for your 'Processed' label.
* Send Urgent Alert: Update YOUR
TELEGRAMCHATID.

  1. Activation: Once all credentials and settings are configured, activate the n8n workflow to start monitoring your inbox.

Node Details

Email_Trigger (Gmail Trigger): This critical n8n trigger initiates the entire automation when a new, unhandled email arrives. It is configured to download attachments immediately.
AI Email Classifier (Langchain Chain LLM n8n node): The core intelligence. This n8n node uses gpt-4o-mini combined with structured output parsers to classify the email based on thread context, urgency, and reply requirements, outputting a precise JSON object.
Get All Gmail Labels / Filter User Labels: These n8n nodes ensure the AI model receives a dynamic list of user-created labels for accurate categorization, maintaining consistency within the n8n workflow.
Smart Action Router (Switch n8n node): Routes execution paths based on the output of the classifier (e.g., reply needed, urgent alert required, attachments to handle).
AI Response Generator (Langchain Chain LLM n8n node): Generates context-aware, professional draft responses following detailed instructions, minimizing time spent on routine replies.
Create Draft Response (Gmail n8n node): Takes the AI-generated response and saves it as a draft within the original email thread, leveraging the thread ID from the n8n trigger data.
Upload to Google Drive (Google Drive n8n node): Handles attachment storage, implementing checks for existing files to prevent duplicates and standardizing filenames (date/sender/subject) for better organization. This is a crucial file management n8n node.
Assign Classification Label / Mark as Processed (Gmail n8n node): Applies the specific category and status labels determined by the AI to the email, ensuring a tidy and well-organized inbox.

Related n8n Workflows

Free

Nodes: 16 Nodes
Updated: December 26 2025
View all
Created by
Ronnie Craig
Ronnie Craig

Hi, I’m Ronnie! I scaled an eCommerce biz to $14K/month in under a year, grew a YouTube channel to 1K subs in 30 days, booked 28 daycare appointments in 6 days, and built automations for nurses to track clients. I help you create content, repurpose high-performing posts, schedule with ease, monitor trends, and automate marketing—so you stay visible and consistent without burning out.

Featured*