Skip to main content

AI-powered email replies with spam filtering & FAQ lookup using GPT-4o mini & Pinecone

Workflow preview

Workflow preview
100%
AI-powered email replies with spam filtering & FAQ lookup using GPT-4o mini & Pinecone preview
Open on n8n.io

Important notice

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

1. Workflow Overview

This n8n workflow automates the handling of incoming emails. It detects and filters out spam, searches a knowledge base (FAQ) stored in a Pinecone vector database, and sends a reply using Gmail — a...

Best for

  • Ticket Management automation workflows
  • AI RAG automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.memorybufferwindow, n8n-nodes-base.gmailtool, n8n-nodes-base.gmailtrigger, n8n-nodes-base.gmail, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.vectorstorepinecone

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
AI-powered email replies with spam filtering & FAQ lookup using GPT-4o mini & Pinecone
Workflow name
AI-powered email replies with spam filtering & FAQ lookup using GPT-4o mini & Pinecone

This n8n workflow automates the handling of incoming emails. It detects and filters out spam, searches a knowledge base (FAQ) stored in a Pinecone vector database, and sends a reply using Gmail — all powered by an AI model (GPT-4o mini).

How It Works

  1. Receiving Emails
  • The Gmail Trigger node checks a Gmail inbox every hour.

  • When a new email arrives, it starts the workflow.

  1. Fetching Full Email Content
  • The get_message node retrieves all the details of the message: sender, subject, text, message ID, etc.
  1. Spam Filtering
  • The Spam checker node uses GPT-4o mini to classify the email as either "spam" or "no spam".

  • It detects not only classic spam but also automated messages (e.g. from Google or Microsoft).

  • If marked as "spam", the workflow ends and nothing is processed.

  1. Conditional Filter
  • The If node checks the spam result.

  • Only "no spam" emails proceed to the AI Agent.

  1. AI-Based Reply
  • The AI Agent node generates a response based on:

    • The email content

    • A system prompt defining the assistant’s behavior (polite, professional, under the name “Total AI Solutions”)

    • Information retrieved from the Pinecone Vector Store, which contains FAQs

  • The AI is instructed to always check the vector store before replying.

  • The AI prepares both the subject and the body of the reply.

  1. Sending the Reply
  • The Gmail node sends the reply to the original sender.

  • It uses the original email's ID to keep the thread intact.

  1. Language Model
  • The OpenAI Chat Model node provides GPT-4o mini as the language engine for generating responses.
  1. Memory Support
  • The Simple Memory node maintains short-term context, helpful in multi-turn conversations.
  1. Knowledge Base (FAQ)
  • The Pinecone Vector Store node connects to a Pinecone index (faqmattabott) containing vectorized FAQ content.

  • Vectors are created using the Embeddings OpenAI node.

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 - AI Agent

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

Block 2 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 3 - Simple Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 4 - Gmail

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

Block 5 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 6 - get_message

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

Block 7 - Sticky Note

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

Block 8 - Sticky Note1

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

Block 9 - Sticky Note2

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

Block 10 - Pinecone Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1.1

Block 11 - Embeddings OpenAI

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 12 - If

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

Block 13 - Spam checker

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

3. Summary Table

Workflow AI-powered email replies with spam filtering & FAQ lookup using GPT-4o mini & Pinecone
Complexity intermediate
Nodes 13
Categories Ticket Management, AI RAG
Author Matteo
Published 23 Jun 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5142/5142.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 email replies with spam filtering & FAQ lookup using GPT-4o mini & Pinecone do?

This n8n workflow automates the handling of incoming emails. It detects and filters out spam, searches a knowledge base (FAQ) stored in a Pinecone vector database, and sends a reply using Gmail — a...

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 Ticket Management, AI RAG use case.