Email Classification and Human-in-the-Loop AI Reply Assistant - n8n Workflow

Automate Gmail management using this advanced n8n workflow. Classify incoming emails with GPT-4o, draft replies, and use the gotoHuman n8n node for mandatory human review and supervision.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Businesses needing automated tier-1 email support responses.

  • Teams requiring mandatory human review before sending AI-generated communications.

  • Users looking for advanced examples of a complex n8n workflow integrating AI and human review systems.

  • Automation specialists seeking robust n8n templates for email processing.

Overview

Managing high volumes of incoming emails efficiently often requires both the speed of AI and the accuracy of human oversight. This sophisticated n8n workflow solves this by providing an end-to-end solution for Gmail automation.

This n8n template uses the power of GPT-4o-mini (via the OpenAI n8n node) to perform two critical functions: first, classifying the email (e.g., Customer Support, Sales, Spam), and second, drafting a contextually relevant response. Crucially, before any reply is sent, the workflow implements a 'Human-in-the-Loop' using the dedicated gotoHuman n8n node. This ensures that every outgoing message is approved or edited by a human reviewer, preventing errors and maintaining brand quality. This comprehensive n8n workflow is perfect for scaling communication responsibly.

How it Works

The entire process is initiated by the Gmail n8n trigger, which monitors for new incoming messages.


  1. Trigger: The New Email n8n trigger starts the workflow upon receiving a new email.

  2. Classification: The email is passed to the AI Classifier n8n node (powered by GPT-4o-mini). This classifies the intent and determines two crucial flags: whether a reply is needed, and if the email is important.

  3. Routing: A Switch n8n node (Needs Human Attention?) directs the flow. If a reply is needed, or if the email is important (even without a reply), the process continues to the drafting stage.

  4. Drafting: The Set Prompt n8n node prepares instructions for the AI, and the AI Email Writer n8n node (using another GPT-4o-mini model) generates a detailed draft response, including placeholders for human input if necessary.

  5. Human Review: The workflow submits the original email, classification, and the AI draft to the gotoHuman: Human review n8n node. The human reviewer can approve, reject, or request a retry/edit.

  6. Post-Review Decision: The Human response Switch n8n node handles the review outcome. If approved, the reply is sent. If rejected, the n8n workflow terminates that branch. If a retry is requested (e.g., the human edits the prompt), the flow loops back through the Set (edited) prompt n8n node to regenerate the draft via the AI Email Writer n8n node.

  7. Final Action: Upon final approval, the Reply to thread Gmail n8n node sends the approved draft back to the original sender.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Prerequisites: You must have credentials for Gmail (for the n8n trigger and final action), OpenAI (for the classification and drafting via the specialized n8n node), and a gotoHuman account.

  2. Install gotoHuman Node: Before importing the n8n workflow JSON, ensure the @gotohuman/n8n-nodes-gotohuman package is installed in your n8n instance.

  3. Import Template: Copy the provided n8n workflow JSON and paste it into your n8n canvas using the 'Import from JSON' option.

  4. Configure Credentials: Update the New Email and Reply to thread n8n node instances with your Gmail credentials. Update the OpenAI Chat Model n8n nodes with your OpenAI API key.

  5. Configure gotoHuman: Create a review template in your gotoHuman account (ID: v81wzxwYoFYvWpmuIBgX is recommended, as noted in the sticky note). Configure the gotoHuman: Human review n8n node with your gotoHuman API key and select the newly imported review template.

  6. Activate: Save the n8n workflow and activate the New Email n8n trigger to begin monitoring your inbox.

Node Details

New Email (Gmail Trigger): The critical n8n trigger that starts the automation. It checks the linked Gmail account every minute for new emails.
AI Classifier (LangChain Agent n8n node): Uses GPT-4o-mini to analyze the full email text against a system message, outputting a structured JSON classification (category, needsReply, important).
Structured Output1 (LangChain n8n node): Ensures the classification output from the AI is correctly parsed into a usable JSON object for the next n8n node.
Needs Human Attention? (Switch n8n node): Manages flow control based on the classification results. It branches the n8n workflow depending on whether a reply is mandated or if the email is flagged as important.
AI Email Writer (LangChain Agent n8n node): If a reply is needed, this n8n node leverages GPT-4o-mini to draft a context-aware response based on the defined prompt set by the preceding Set Prompt n8n node.
gotoHuman: Human review (gotoHuman n8n node): The core human supervision element. It sends the original email and AI draft to a human reviewer. It is configured to handle retry inputs from the reviewer, feeding them back into the n8n workflow.
Human response (Switch n8n node): Determines the outcome of the human review (approved, rejected, or chat/retry). This ensures robust flow control in the middle of the n8n workflow.
Set (edited) prompt (Set n8n node): Captures the updated prompt or chat content from the human reviewer when a retry is initiated, allowing the AI to iterate on the response before looping back to the AI Email Writer n8n node.


  • Reply to thread (Gmail n8n node): The final action. This n8n node sends the human-approved draft as a reply within the original Gmail thread.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Approve critical actions in gotoHuman’s customizable review interface and edit AI outputs manually or by looping back to your workflow. Ensure AI-generated content is on-brand, messages to customers are accurate, and high-stakes decisions are made by humans.

Featured*