Document-Aware AI Chatbot with Persistent Memory (OpenAI, Pinecone, Google Drive) - n8n Workflow

Deploy an advanced n8n workflow integrating OpenAI, Pinecone, and Google Drive to power a customer support AI Agent with persistent memory and RAG capabilities.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Companies needing scalable, document-aware customer support solutions.
Users looking for sophisticated n8n templates for AI agent deployment and RAG architecture.
Developers interested in implementing long-term memory management within an n8n workflow.
Businesses aiming to automate support responses based on internal documentation stored in Google Drive.

Overview

This sophisticated n8n workflow addresses the challenge of building intelligent, context-aware chatbots that can learn from company documentation and remember past conversations. By combining the power of the n8n node ecosystem, specifically the LangChain n8n nodes, with cutting-edge AI services like OpenAI and vector databases like Pinecone, this automation provides a robust solution. The complete n8n workflow is divided into two functional sections: an ingestion pipeline that processes documents from Google Drive and stores them in Pinecone, and a live chat agent that uses this knowledge base alongside persistent conversation memory (stored in Airtable) to deliver professional customer support. Utilizing this pre-built n8n template significantly accelerates the deployment of high-quality AI customer service.

How it Works

The n8n workflow operates in two main modes: Document Ingestion and Live Chat Handling.

1. Document Ingestion Pipeline

This path starts with the manual trigger n8n node (When clicking 'Test Workflow' button).

  1. Retrieval: The Google Drive n8n node lists and downloads documentation files from a specified folder.

  2. Processing: The Default Data Loader handles the binary content, and the Recursive Character Text Splitter n8n node breaks the documents into smaller, embeddable chunks.

  3. Embedding: The Embeddings OpenAI n8n node converts these text chunks into high-density vector representations.

  4. Storage: The Pinecone Vector Store n8n node (set to 'insert' mode) saves these embeddings to the index, establishing the knowledge base used by the RAG tool.

2. Live Chat Agent

The core automation begins with the When chat message received n8n trigger.

  1. Memory Retrieval: The flow immediately uses the Airtable n8n node (Get Memories) to fetch the user's past conversation history, identified by user ID ('Astrid' in this example).

  2. Context Assembly: The retrieved memories are combined using the Aggregate and Merge n8n nodes, enriching the incoming message context.

  3. AI Agent Execution: The core AI Agent n8n node processes the message. It uses a detailed system prompt for customer support and leverages the Simple Memory buffer for short-term context.

  4. Tool Use (RAG): If the agent determines it needs external data (e.g., FAQs or pricing), it invokes the Answer questions with a vector store tool. This tool queries the Pinecone knowledge base using the secondary set of Embeddings OpenAI1 and the Pinecone Vector Store1 n8n node to retrieve document-grounded answers.

  5. Memory Persistence: After generating and sending the final answer, the agent utilizes the Save Memory n8n node (an Airtable Tool) to write the new conversation history back to Airtable, ensuring persistent memory for the next interaction. This entire process demonstrates the power of the n8n workflow in action.

Installation Guide

To successfully deploy this advanced n8n workflow, follow these setup steps:


  1. Import: Copy the n8n workflow JSON and paste it into your n8n instance using the 'Import Workflow' option.

  2. Credentials Setup: Configure the required credentials. This n8n workflow requires credentials for:

OpenAI API: For embeddings and chat models.
Pinecone API: To manage the vector index.
Google Drive: To access your source documentation.
Airtable: For storing and retrieving user conversation memories.

  1. Knowledge Base Initialization: Before activating the chatbot, run the document ingestion flow. Click the 'Execute Workflow' button on the When clicking 'Test Workflow' button n8n node path to upload your Google Drive documents to Pinecone.

  2. Activation: Ensure the When chat message received n8n trigger is active. The webhook URL associated with this n8n trigger must be configured in your application or chat interface to send incoming messages to the n8n workflow.

Node Details

When chat message received (n8n trigger): The primary LangChain n8n node that listens for incoming chat messages to initiate the conversation response cycle.
Google Drive (n8n node): Manages document ingestion, listing files, and downloading binary content from the specified source folder.
Recursive Character Text Splitter (n8n node): An essential LangChain utility that strategically breaks down large documents into smaller, context-preserving chunks for effective vectorization.
Pinecone Vector Store (n8n node): Serves two roles: inserting document vectors during ingestion and providing the vector search capability for the RAG tool.
Get Memories / Save Memory (Airtable n8n node): Manages the long-term, persistent memory. Get Memories retrieves previous context, while Save Memory acts as an agent tool to record the ongoing conversation context.
Embeddings OpenAI (n8n node): Responsible for generating the vector embeddings necessary for both knowledge base creation and knowledge base lookup queries.
AI Agent (n8n node): The central decision-maker. It is configured with a detailed system message defining its role, tone, and operational rules, coordinating the use of its available tools (the Vector Store and Memory Saver).
Answer questions with a vector store (n8n node): Configured as a dedicated tool for the AI Agent. When called, this n8n node executes a RAG search against Pinecone to provide accurate, documentation-backed responses.

Related n8n Workflows

Free

Nodes: 18 Nodes
Updated: December 26 2025
View all
Created by
Sally
Sally

Featured*