Animated data flow diagram

AI Knowledge-Powered Email Auto-Responder Agent with Approval

Version: 1.0.0 | Last Updated: 2025-05-16

Integrates with:

OpenAI Qdrant Gmail OpenRouter IMAP

Overview

Unlock Intelligent Email Automation with this AI Agent

This n8n workflow acts as a sophisticated AI agent for managing your email inbox. It automatically processes new emails, understands their content, drafts contextually relevant replies by tapping into your company's knowledge base, and then presents these drafts for a quick Yes/No approval before any communication is sent. This blend of AI efficiency and human oversight ensures both speed and accuracy in your email correspondence.

This AI Agent excels at:

  • Email Summarization: Quickly distills the key points of incoming emails using DeepSeek.
  • Knowledge-Augmented Response Generation (RAG): Drafts replies by consulting your dedicated Qdrant vector store, ensuring answers are informed by your specific business data.
  • Context-Aware Email Drafting: Leverages OpenAI's GPT-4o-mini to write professional, concise, and relevant email bodies in HTML format.
  • Human-in-the-Loop Approval: Integrates a crucial approval step via Gmail, allowing you to review and greenlight AI-generated responses before they reach recipients.

Key Features & Benefits

  • Handles IMAP Emails: Connects to your existing email server to fetch new messages.
  • AI-Powered Summarization: Uses DeepSeek (via OpenRouter) to create concise summaries of incoming emails, saving you read time.
  • Intelligent Response Drafting: Employs an AI Agent (OpenAI GPT-4o-mini) with Retrieval Augmented Generation (RAG) from a Qdrant vector store to craft accurate and context-rich replies.
  • Built-in Approval Workflow: Sends draft replies to a designated Gmail account for a simple 'Approve' or 'Reject' action, ensuring quality control.
  • Automated Sending: Once approved, the email is automatically sent to the original sender.
  • Customizable AI Prompts: Tailor the AI's tone, style, and response constraints.
  • Reduces Manual Email Load: Significantly cuts down time spent on repetitive email tasks, freeing up your team for higher-value work.
  • Improves Response Consistency: Ensures replies are consistent with your company's knowledge and voice.

Use Cases

  • For B2C e-commerce: Automate initial responses to customer inquiries about orders or products, using your FAQs and product info for RAG, with a review step before sending.
  • For B2B SaaS companies: Streamline Tier 1 support by auto-drafting answers to common technical questions from your knowledge base, then routing for quick approval.
  • Managing partnership or sales inquiries: Provide swift, informed initial replies based on your company info, ensuring leads are engaged promptly while maintaining message quality via approval.
  • Internal helpdesks: Auto-draft responses to common employee questions by querying internal documentation, reducing support staff workload.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • IMAP credentials for the email account to monitor.
  • SMTP credentials for sending final approved emails.
  • OpenRouter API Key (for DeepSeek R1 model access used in summarization).
  • OpenAI API Key (for gpt-4o-mini used in response generation and text-embedding-ada-002 or similar for embeddings).
  • Access to a Qdrant instance (URL and API Key if secured).
  • A Qdrant collection populated with your vectorized knowledge base documents.
  • Gmail account credentials (OAuth2) for the 'Send Draft' node, as it uses Gmail's 'send and wait for response' feature for approval.

Setup Instructions

  1. Download the n8n workflow JSON file.
  2. Import the workflow into your n8n instance.
  3. Configure Email Nodes:
    • 'Email Trigger (IMAP)': Set up your IMAP server details and credentials.
    • 'Send Email': Configure your SMTP credentials for dispatching the final approved email.
  4. Configure AI Model Credentials:
    • 'DeepSeek R1' node: Add your OpenRouter API credentials.
    • 'OpenAI' (for gpt-4o-mini) and 'Embeddings OpenAI' nodes: Add your OpenAI API credentials.
  5. Configure Qdrant Vector Store:
    • 'Qdrant Vector Store' node: Enter your Qdrant instance URL and API Key (if required).
    • In the same node, set the qdrantCollection parameter to the name of your existing Qdrant collection. The default value ={{ $json.COLLECTION }} implies it might expect an environment variable or a fixed value set here.
  6. Configure Approval Workflow:
    • 'Send Draft' (Gmail) node: Configure your Gmail OAuth2 credentials. Crucially, set the sendTo parameter to the Gmail address that will receive and approve the draft emails. This node relies on Gmail's specific approval features.
  7. Customize AI Behavior:
    • 'Email Summarization Chain' node: Review and adjust the summarization prompts if needed.
    • 'Write email' (Agent) node: Customize the systemMessage to define the AI's persona, response length, and other instructions for drafting emails.
  8. Prepare Knowledge Base: Ensure your Qdrant collection is populated with relevant, vectorized documents that the AI Agent will use to answer questions.
  9. Test the workflow with a few sample emails.
  10. Activate the workflow.

Tags:

AI AgentEmail AutomationOpenAIDeepSeekQdrantRAGCustomer SupportProductivityApproval Workflow

Want your own unique AI agent?

Talk to us - we know how to build custom AI agents for your specific needs.

Schedule a Consultation