RAG Chatbot with Google Drive, Mistral OCR, and Qdrant - n8n Workflow

Build an advanced RAG chatbot using this n8n workflow template. It manages Google Drive document ingestion, uses Mistral AI for OCR and embeddings, and stores data in Qdrant for fast retrieval.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Automation specialists seeking advanced RAG solutions.
Companies needing a high-performance knowledge base chatbot for their website.
Developers looking for an example of a multi-step n8n document processing pipeline.
Technical users wanting to integrate Mistral AI’s powerful OCR and embedding services with an n8n workflow.


  • Anyone interested in using n8n templates to deploy AI agents that leverage vector databases.

Overview

This comprehensive n8n workflow addresses the challenge of making unstructured, brand-specific documents (like PDFs, guides, or reports stored in Google Drive) instantly searchable and usable by an AI chatbot. It operates in two major phases: a Document Ingestion Pipeline and a Real-Time Chat Agent.

The ingestion pipeline uses the robust combination of Mistral AI’s specialized OCR services and custom chunking logic within an n8n node to efficiently process documents, extract key data, and prepare it for embedding. The resulting vector data is stored in Qdrant. This ensures the chatbot, powered by an OpenAI model, has the highest quality, most relevant knowledge available. This powerful n8n workflow provides a scalable, context-aware conversational experience for website visitors, dramatically enhancing customer support and engagement by leveraging your existing document assets.

How it Works

This n8n workflow template is divided into two distinct logical branches: the Data Ingestion Pipeline (for building the knowledge base) and the Chat Agent (for responding to live queries).

1. Data Ingestion Pipeline (Manual Trigger)


  1. Start: The process begins with the When clicking ‘Execute workflow’ n8n trigger, initiating the data load.

  2. Source Data: The Google Drive(brand related data for chatbot) n8n node fetches a list of files from a specified folder ID containing brand knowledge documents.

  3. Iteration and Download: The list of files is processed via a loop (Loop Over Items1). For each file, metadata is set, and the file is downloaded using the Google Drive(load file) n8n node.

  4. Mistral OCR: The file is uploaded to Mistral AI via Mistral Upload, a signed URL is retrieved (Mistral Signed URL), and the document is processed for text extraction using the Mistral DOC OCR HTTP Request node. This ensures text is extracted accurately even from complex document types.

  5. Chunking Preparation: If the OCR succeeds, data is prepared (prepare for chunking).

  6. Custom Chunking: A Code(convert to chunks for loading into vector db) n8n node executes custom logic to split the potentially large OCR output into optimally sized chunks (1000 characters) suitable for vector storage, ensuring relevant retrieval.

  7. Embedding & Storage: The chunks are embedded using the Embeddings Mistral Cloud n8n node and then inserted into the designated Qdrant collection (Qdrant Vector Store1). This completes the knowledge base setup.

2. Real-Time Chat Agent (Chat or Webhook Trigger)


  1. Request Initiation: The live chat process starts via either the When chat message received LangChain n8n trigger (for integrated chat) or an external Webhook.

  2. Agent Execution: The website chat agent LangChain n8n node receives the user query. This agent is configured with strict system instructions (rules 1-8 in the prompt) mandating it to use the vector database as its primary source.

  3. Retrieval: The agent utilizes the Qdrant Vector Store tool, which uses Embeddings Mistral Cloud1 to embed the user's query and retrieve contextually relevant documents from the vector database.

  4. Generation: The retrieved context, along with the user’s query and conversation history (managed by Simple Memory), is fed to the OpenAI Chat Model (GPT-4o mini) to generate the final, authoritative response, ensuring answers are based only on the provided documents. The final output is returned to the user via the initial n8n trigger or webhook.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON code and paste it into your n8n instance using the 'Import from JSON' feature.

  2. Credential Setup: You must configure the following credentials:

OpenAI: Set up credentials for the OpenAI Chat Model n8n node.
Mistral Cloud: Set up credentials for both the embeddings and the HTTP Request nodes used for OCR (Mistral Upload, Mistral DOC OCR).
Qdrant API: Configure credentials for the two Qdrant Vector Store n8n node instances.
Google Drive OAuth2: Set up credentials for the Google Drive n8n node to access your document folder.

  1. Configure Document Source: In the Google Drive(brand related data for chatbot) n8n node, update the 'Folder ID' parameter to point to the specific Google Drive folder containing your knowledge base documents.

  2. Configure Vector Database: In all Qdrant Vector Store n8n node instances, ensure the 'Qdrant Collection' parameter is set to your target collection name (e.g., docragtestkb).

  3. Initialize Knowledge Base: Execute the workflow manually via the 'When clicking ‘Execute workflow’' n8n trigger once to populate the Qdrant database with your document data.

  4. Deployment: Activate the main n8n workflow to enable the real-time chat agent and webhooks.

Node Details

When chat message received (n8n trigger): The primary entry point for embedded chat solutions. It waits for incoming user queries to fire the n8n workflow.
Google Drive (n8n node): Used to list files from a designated folder and then download individual files for processing in the ingestion pipeline.
Set metadata (n8n node): A utility node used to extract critical file metadata (ID, title, URL) from the Google Drive item, which is then passed through the pipeline and used to enrich the chunk metadata.
Mistral DOC OCR (HTTP Request n8n node): Crucial for the ingestion pipeline. It interacts with the Mistral AI API to perform Optical Character Recognition on uploaded documents, converting complex file formats into extractable, structured text.
Code(convert to chunks for loading into vector db) (n8n node): This custom n8n node contains sophisticated JavaScript logic to ensure optimal document chunking (1000 characters), which is vital for efficient RAG retrieval.
Embeddings Mistral Cloud (n8n node): Used twice in this n8n workflow—once for generating embeddings for the documents being ingested, and once for generating embeddings for the live user query.
Qdrant Vector Store (n8n node): Used for both data insertion (ingestion branch) and as a 'retrieve-as-tool' (chat branch) within the LangChain agent framework. This is the core knowledge storage mechanism.
OpenAI Chat Model (LangChain n8n node): Serves as the Large Language Model (LLM) engine (specifically GPT-4o mini) for the agent, generating final responses based on retrieved context.


  • website chat agent (LangChain n8n node): The core intelligence of this n8n workflow. It orchestrates the retrieval process using tools (Qdrant) and memory (Simple Memory) to deliver contextually correct, rule-based answers.

Related n8n Workflows

Free

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

Digital Biz Tech empowers organizations to unlock their knowledge and creativity with AI. From zero-retention assistants that deliver secure, source-linked answers to intelligent content engines that generate and schedule on-brand campaigns, we transform how teams access, create, and act on information. 📩 For consulting or collaborations, contact [email protected]

Featured*