AI-Powered Personalized Email Generator using Pinecone and GPT-4o - n8n Workflow

Deploy this advanced n8n workflow to automate hyper-personalized email outreach. It integrates Google Docs, Pinecone, and GPT-4o agents to retrieve contact data, dynamically compose content, and send emails via the Gmail n8n node.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical teams and developers exploring advanced AI Agent architecture in n8n.

  • Marketing or sales operations needing scalable, context-aware personalized email outreach.

  • Users interested in leveraging RAG (Retrieval-Augmented Generation) with n8n templates.

  • Organizations seeking to automate complex, data-driven communication flows.

Overview

This is a sophisticated, multi-workflow automation designed to manage personalized communications based on stored knowledge. The system solves the common challenge of contextually personalized outreach by separating data ingestion, intelligence gathering, and final action execution across three distinct stages. First, contact data from Google Docs is vectorized and stored in Pinecone (RAG knowledge base). Second, a core AI Agent, triggered by a chat message, intelligently decides which contacts to retrieve from Pinecone and orchestrates the composition and delivery process. Finally, a sub-workflow leverages the Gmail n8n node to dispatch the resulting email. This robust n8n workflow ensures high efficiency and accuracy in personalized mass communication.

How it Works

The overall process is divided into three interdependent parts executed through interconnected n8n workflows:

Part 1: Data Ingestion


  1. The process begins with a manual n8n trigger, initiating the Google Docs n8n node to fetch raw contact information.

  2. The data is prepared using the Default Data Loader and optimized via the Recursive Character Text Splitter.

  3. The Embeddings OpenAI n8n node converts the text data into numerical vectors.

  4. These vectors are then upserted into the n8ndocs index in Pinecone via the Pinecone Vector Store n8n node (Namespace: docsmail), establishing the knowledge base.

Part 2: Core AI Agent Orchestration


  1. The automation goes live upon receiving a prompt through the When chat message received n8n trigger.

  2. The main AI Agent1 (using GPT-4o) processes the request. Its strict rules require using two tools sequentially.

  3. Retrieval Tool: It first uses the Vectorstore Mails tool (connected to Pinecone) to perform a similarity search, retrieving the recipient's email address from the knowledge base based on keywords in the prompt (e.g., retrieving [email protected] for 'winter test').

  4. Action Tool: The agent then utilizes the send_mail Workflow Tool (referencing the final dispatch n8n workflow) to dynamically pass the generated subject, body, and retrieved recipient email.

Part 3: Email Dispatch Sub-Workflow


  1. This separate n8n workflow is activated by the When Executed by Another Workflow n8n trigger, receiving the structured email content from the core agent.

  2. A final AI Agent (using GPT-4o-mini) standardizes and formats the incoming data into clear To, Subject, and Message fields.

  3. The Gmail n8n node executes the final action, sending the perfectly formatted, personalized email.

Installation Guide

To deploy this comprehensive set of n8n templates, follow these steps:


  1. Import the Workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Identify Required Credentials: You will need to configure credentials for the following services:

- OpenAI: Required for Embeddings and Chat Models (GPT-4o/GPT-4o-mini).
- Pinecone: Required for the Vector Store connection.
- Gmail: Required for sending the final emails.
- Google Docs: Required for the initial data ingestion step.

  1. Configure Google Docs: Update the URL parameter in the Google Docs n8n node (Get a document) to point to your document containing the contact information.

  2. Configure Workflow Tool: Ensure the send_mail tool references the correct internal ID of the email dispatch workflow once both parts are imported. Note: The workflow ID is currently specified as GLkrSkyYtlep3P6e.

  3. Run Setup: Execute the top section (triggered by When clicking ‘Test workflow’) once to populate the Pinecone vector database before activating the main flow.

Node Details

When clicking ‘Test workflow’ (n8n trigger): Used exclusively to initiate the one-time data ingestion of contact information from Google Docs into Pinecone.
Google Docs (n8n node): Retrieves the document content which contains the source data for personalization and contact lists.
Embeddings OpenAI (n8n node): Generates high-quality vector representations of the contact data for semantic search capability.
Pinecone Vector Store (n8n node): Used for two distinct operations: initially for insert (upserting data) and subsequently for search via the RAG tool, using the n8ndocs index.
When chat message received (n8n trigger): The webhook-based listener that starts the AI decision chain based on a user prompt.
AI Agent1 (n8n node): The core intelligence, using GPT-4o, responsible for analyzing the request and determining the necessary sequence of tool usage (Pinecone lookup then send email).
Vectorstore Mails (n8n tool): An RAG retrieval n8n node that interfaces with Pinecone to fetch contextually relevant email addresses.
send_mail (n8n tool): A crucial n8n workflow tool that delegates the final email dispatch task to the subsequent workflow, facilitating complex multi-step orchestration.
When Executed by Another Workflow (n8n trigger): Receives the final, contextually rich data payload from the initiating AI Agent.
AI Agent (n8n node): The secondary agent using GPT-4o-mini, specifically tasked with structuring the final To, Subject, and Message content from the received input.


  • Gmail (n8n node): The final action node, securely sending the personalized email using data extracted and formulated by the preceding AI Agents.

Related n8n Workflows

Free

Nodes: 14 Nodes
Updated: December 26 2025
View all
Created by
Belgacem Dhiflaoui
Belgacem Dhiflaoui

Featured*