RAG Chatbot for Customer Support with OpenAI and Pinecone - n8n Workflow

Deploy a powerful RAG chatbot using this specialized n8n workflow. Integrates Google Drive, OpenAI, Pinecone, and Cohere to provide accurate, context-aware answers using n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Businesses needing automated customer support or internal knowledge retrieval.
Developers looking for advanced RAG n8n templates.
Users who want to build a self-updating knowledge base fed from Google Drive.
n8n Automation Specialists focused on large language model (LLM) orchestration.

Overview

This comprehensive n8n workflow solves the problem of hallucination in AI chatbots by implementing a robust Retrieval-Augmented Generation (RAG) architecture. It automates the entire lifecycle, encompassing both knowledge ingestion and user query answering.

The workflow features a document ingestion pipeline triggered by new files in Google Drive, which are then processed, embedded using the powerful OpenAI n8n node, and stored in Pinecone. The second path is the live chatbot, utilizing an AI Agent that leverages the Pinecone vector store as a search tool. The results are refined by a Cohere Reranker, ensuring highly relevant and accurate responses based only on the indexed data. This is a critical n8n template for deploying enterprise AI applications that require data grounded responses.

How it Works

This complex n8n workflow operates in two parallel execution paths:

1. Knowledge Base Ingestion Pipeline

The process starts with the Google Drive n8n trigger, which monitors a specified folder (e.g., 'Snapfectly RAG') for newly created files. Once detected, the file is downloaded using the Google Drive n8n node. The file content is then loaded by the Default Data Loader n8n node. To prepare the text for vector storage, the Recursive Character Text Splitter n8n node breaks the large document into smaller, manageable chunks. These chunks are then vectorized using the Embeddings OpenAI n8n node. Finally, the Pinecone Vector Store n8n node indexes the resulting data into the specified Pinecone index, completing the knowledge update.

2. Live Chatbot Response Engine

The live conversation starts with the When chat message received n8n trigger, acting as the entry point for the user query. This immediately activates the AI Agent n8n node, the core orchestrator. The Agent uses the OpenAI Chat Model (specifically gpt-4.1-mini) for reasoning and response generation. The Simple Memory n8n node ensures that conversation context is maintained across interactions.

Crucially, the Agent leverages the specialized Vector Store n8n node, configured as a retrieve-as-tool, to search the knowledge base. This retrieval tool uses OpenAI embeddings and includes a Cohere Reranker n8n node to refine the relevance of the top 10 retrieved documents. By grounding the LLM with highly filtered, authoritative context, the AI Agent ensures its final answer strictly adheres to the indexed information, providing high-quality support.

Installation Guide

To set up and utilize this powerful RAG n8n workflow, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON and import it into your n8n instance.

  2. Credentials Setup: You must configure credentials for the following services, as they are essential for the operation of this n8n template:

OpenAI (used for both embeddings and the primary chat model).
Pinecone (for the vector store, handling both insertion and retrieval).
Google Drive (required by the Google Drive n8n trigger for document ingestion).
Cohere (for the Reranker n8n node).

  1. Google Drive Trigger Configuration: Ensure the Google Drive n8n trigger is correctly pointing to the specific Google Drive folder ID where your knowledge documents are uploaded.

  2. Pinecone Configuration: Verify that all Pinecone Vector Store n8n nodes are configured to use your target Pinecone index (e.g., snapfectly).

  3. Activation: Once all dependencies and credentials are set, activate the n8n workflow to enable both the document ingestion monitoring and the live chatbot service.

Node Details

Google Drive Trigger (n8n trigger): Starts the ingestion process whenever a new file is created in the watched folder. Essential for building a dynamic knowledge base.
Download file (Google Drive n8n node): Retrieves the newly created file content based on the ID provided by the n8n trigger.
Recursive Character Text Splitter: A LangChain n8n node that systematically divides long documents into smaller, processable text chunks for efficient embedding.
Embeddings OpenAI (x2 instances): Converts text chunks (ingestion path) and search queries (retrieval path) into numerical vectors using the OpenAI embedding service.
Pinecone Vector Store (Ingestion): Configured in insert mode to write the new vector data and associated metadata into the 'snapfectly' Pinecone index.
When chat message received (n8n trigger): The primary entry point n8n trigger for the live user chatbot interaction.
OpenAI Chat Model: Provides the core reasoning capabilities for the AI Agent using the gpt-4.1-mini model.
Simple Memory: Maintains the state of the conversation, allowing the AI Agent to reference previous turns.
Vector Store (Retrieval): Configured as a retrieve-as-tool for the AI Agent. It handles the search query to Pinecone, configured for topK: 10 results.
Reranker Cohere: An advanced n8n node integrated into the retrieval tool to enhance the relevance ranking of the Pinecone search results before the context is presented to the LLM.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

I design and build custom no-code and low-code automations using n8n to help businesses save hours of manual work, streamline operations, and create clean, scalable workflows.

Featured*