Skip to main content

AI-powered lead email classification & auto-reply with GPT-4o and Gmail

Workflow preview

Workflow preview
100%
AI-powered lead email classification & auto-reply with GPT-4o and Gmail preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

How it works This workflow automatically responds to incoming emails identified as potential leads using AI generated text. It connects to your email inbox via IMAP, classifies incoming messages wi...

Best for

  • AI Chatbot automation workflows
  • Multimodal AI automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.emailreadimap, n8n-nodes-base.filter, n8n-nodes-base.gmail, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.openai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Rodrigo.

Original n8n.io source

1.1 Workflow description

Title
AI-powered lead email classification & auto-reply with GPT-4o and Gmail
Workflow name
AI-powered lead email classification & auto-reply with GPT-4o and Gmail

How it works

This workflow automatically responds to incoming emails identified as potential leads using AI-generated text.
It connects to your email inbox via IMAP, classifies incoming messages with an AI model, filters out non-leads, and sends a personalized reply to relevant messages.

Steps

  1. Email Trigger (IMAP): Watches your inbox for new emails in real time.
  2. Is Lead? (Message Model): Uses AI to determine whether the sender is a lead.
  3. Filter: Passes only lead emails to the next step.
  4. Write Customized Reply (Message Model): Generates a personalized response using AI.
  5. Get Message: Retrieves original email details to ensure correct threading.
  6. Reply to Message: Sends the AI-generated reply to the sender.

Setup Instructions

  • Connect your IMAP Email credentials to the first node and set the folder to watch (e.g., INBOX).
  • In the "Filter leads" node, adjust the AI prompt to match your lead qualification criteria.
  • In the "Reply with customized message" node, edit the AI prompt to reflect your product, service, or business tone.
  • Connect your Gmail (or other email provider) credentials in the Get Message and Reply to Message nodes.
  • Test with a few sample emails before activating.

Requirements

  • IMAP-enabled email account (for receiving messages)
  • Gmail API access (or modify to your email provider)
  • OpenAI or other AI model credentials for message analysis and reply generation

This template is ready to use, with all steps documented inside sticky notes for easy customization.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Email Trigger (IMAP)

Type / Role
n8n-nodes-base.emailReadImap - emailReadImap
Config choices
Version 2

Block 2 - Filter

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 3 - Get Message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 4 - Reply to Message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 5 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Filter leads

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 12 - Reply with customized message

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

3. Summary Table

Workflow AI-powered lead email classification & auto-reply with GPT-4o and Gmail
Complexity intermediate
Nodes 12
Categories AI Chatbot, Multimodal AI
Author Rodrigo
Published 13 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7330/7330.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does AI-powered lead email classification & auto-reply with GPT-4o and Gmail do?

How it works This workflow automatically responds to incoming emails identified as potential leads using AI generated text. It connects to your email inbox via IMAP, classifies incoming messages wi...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your AI Chatbot, Multimodal AI use case.