PDF Knowledge Base Chatbot with Automated Google Drive Ingestion - n8n Workflow

Deploy a powerful RAG system using this comprehensive n8n workflow. Automate PDF ingestion from Google Drive and enable interactive querying via a Telegram chatbot.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Data Engineers needing to automate document ingestion into a knowledge base.
Businesses requiring an interactive Q&A system over technical documentation.
Developers looking for advanced n8n templates integrating LangChain with vector databases.
Automation Specialists seeking to deploy conversational AI agents via Telegram using an n8n trigger.

Overview

This advanced n8n workflow solves the complex challenge of continuously updating a knowledge base from external sources (like Google Drive PDFs) and making that data instantly queryable through a user-friendly conversational interface (Telegram). This robust solution showcases the power of an n8n workflow to integrate diverse services—cloud storage, vector databases (PGVector), and large language models (Azure OpenAI)—into a seamless AI agent experience. Users benefit from automated content ingestion and real-time Q&A, built entirely using specialized n8n templates and nodes. The workflow includes two primary functions: automated mass ingestion via Google Drive and interactive, user-initiated file ingestion and chatting via Telegram. Every part of this n8n workflow uses specific n8n node capabilities to handle file parsing, chunking, embedding, retrieval, and conversation memory.

How it Works

This n8n workflow operates across two parallel, distinct flows:

1. Automated Google Drive Ingestion


  1. Trigger: The Run Ingestion manual n8n trigger starts the process (or can be adapted to an n8n trigger like a schedule or webhook).

  2. File Discovery: The List All File Names Google Drive n8n node fetches a list of PDF files targeted for ingestion.

  3. Looping & Download: The flow uses a Loop Over Items n8n node to process each file individually. The Download Corresponding File node retrieves the binary data.

  4. Ingestion Initiation: The file is pushed to an external service or the dedicated ingestion webhook endpoint using an HTTP Request n8n node (Send PDF File).

  5. Vectorization Pipeline: Documents are routed through the PDF Ingest Webhook or the linked flow path.

The Default Data Loader n8n node loads the document content.
The content is segmented by the Token Splitter n8n node.
The Embeddings Mistral Cloud n8n node converts the text chunks into vectors.
Finally, the Postgres PGVector Store n8n node stores these vectors, completing the ingestion into the RAG knowledge base.

2. Telegram RAG Chat Interface


  1. Conversation Trigger: The process begins with the Telegram Trigger n8n trigger, listening for incoming messages.

  2. Message Check: The If Text Message Received n8n node determines if the input is a text query or a file upload.

  3. RAG Query Path (Text): If text, the query is passed to the LangChain AI Agent (AI Agent2).

The agent uses Azure OpenAI Chat Model3 for generation, maintaining context via the Simple Memory n8n node.
Retrieval is powered by the PGVector store, using Embeddings Mistral Cloud3 to find relevant context.
* The final answer is sent back using the Send a Text Message Telegram n8n node.

  1. Interactive Ingestion Path (File): If a PDF file is attached, the n8n workflow asks the user for approval via Telegram (Approve Ingestion). If approved, the file is downloaded, forwarded for ingestion (similar to the Google Drive path), and the user is notified with a Send Finished Message.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


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

  2. Credentials Setup: You will need credentials for the following services (for the respective n8n node connections):

Google Drive: For the automated ingestion pipeline.
Telegram: For both the Telegram Trigger (input) and the Telegram nodes (output).
Azure OpenAI/OpenAI: For the Azure OpenAI Chat Model nodes (LLM connection).
Mistral Cloud: For the embedding generation nodes.
* PostgreSQL/PGVector: Database credentials for connecting to the vector store.

  1. Webhook Configuration: Activate the workflow. Note the URLs generated for the Telegram Trigger, PDF Ingest Webhook, and the Chat Trigger nodes. Configure your Telegram bot to point incoming traffic to the primary Telegram n8n trigger URL.

  2. LangChain Setup: Ensure your LangChain nodes (PGVector Store, Embeddings, Agent) are configured with the correct model names, collection names, and prompt templates relevant to your RAG use case.

Node Details

Telegram Trigger: Acts as the primary conversational n8n trigger, initiating the RAG flow when a user sends a message or file.
AI Agent2 (LangChain): The core intelligence of the chat component. This n8n node orchestrates the LLM and the RAG tool to formulate responses based on retrieved context.
Azure OpenAI Chat Model3: The LLM used by the AI Agent for response generation and reasoning.
Postgres PGVector Store3: Configured as the retrieval tool for the AI Agent. This n8n node queries the vector knowledge base to find context relevant to the user's question.
Run Ingestion (Manual Trigger): Used as an initialization n8n trigger to manually start the bulk PDF processing pipeline from Google Drive.
List All File Names (Google Drive): This n8n node specifically targets and lists PDF files from a specified Google Drive folder for ingestion.
Default Data Loader (LangChain): Essential n8n node in the ingestion pipeline, responsible for loading the raw PDF file content for further processing.
Token Splitter (LangChain): This n8n node ensures optimal chunking of the document text before embedding, vital for effective RAG performance.
Embeddings Mistral Cloud: Generates high-quality vector representations (embeddings) of the document chunks, a critical step handled by this specific n8n node.
If Text Message Received / If PDF File Received / If User Approved (If Node): Logic control n8n nodes that branch the workflow path based on user input, defining whether the user wants to chat or ingest a file.

Related n8n Workflows

Free

Nodes: 17 Nodes
Updated: December 26 2025
View all
Created by
Meelioo
Meelioo

Delusional of 5 years!🎉🎉

Featured*