Skip to main content

Automate a 'Chat with your PDF' Bot on Telegram with Google Gemini & Pinecone

Workflow preview

Workflow preview
100%
Automate a 'Chat with your PDF' Bot on Telegram with Google Gemini & Pinecone preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n template from Intuz provides a complete solution to automate a powerful, AI driven 'Chat with your PDF' bot on Telegram. It uses Retrieval Augmented Generation (R...

Best for

  • Document Extraction automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, n8n-nodes-base.stopanderror, @n8n/n8n-nodes-langchain.chainretrievalqa, @n8n/n8n-nodes-langchain.retrievervectorstore, @n8n/n8n-nodes-langchain.vectorstorepinecone, n8n-nodes-base.if, n8n-nodes-base.code

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Intuz .

Original n8n.io source

1.1 Workflow description

Title
Automate a 'Chat with your PDF' Bot on Telegram with Google Gemini & Pinecone
Workflow name
Automate a 'Chat with your PDF' Bot on Telegram with Google Gemini & Pinecone

This n8n template from Intuz provides a complete solution to automate a powerful, AI-driven 'Chat with your PDF' bot on Telegram.

It uses Retrieval-Augmented Generation (RAG) to allow users to upload documents, which are then indexed into a vector database, enabling the bot to answer questions based only on the provided content.

Who's this workflow for?

  • Researchers & Students
  • Legal & Compliance Teams
  • Business Analysts & Financial Advisors
  • Anyone needing to quickly find information within large documents

How it works

This workflow has two primary functions: indexing a new document and answering questions about it.

1. Uploading & Indexing a Document:

  • A user sends a PDF file to the Telegram bot.
  • n8n downloads the document, extracts the text, and splits it into small, manageable chunks.
  • Using Google Gemini, each text chunk is converted into a numerical representation (an "embedding").
  • These embeddings are stored in a Pinecone vector database, making the document's content searchable.
  • The bot sends a confirmation message to the user that the document has been successfully saved.

2. Asking a Question (RAG):

  • A user sends a regular text message (a question) to the bot.
  • n8n converts the user's question into an embedding using Google Gemini.
  • It then searches the Pinecone database to find the most relevant text chunks from the uploaded PDF that match the question.
  • These relevant chunks (the "context") are sent to the Gemini chat model along with the original question.
  • Gemini generates a new, accurate answer based only on the provided context and sends it back to the user in Telegram.

Key Requirements to Use This Template

1. n8n Instance & Required Nodes:

  • An active n8n account (Cloud or self-hosted).
  • This workflow uses the official n8n LangChain integration (@n8n/n8n-nodes-langchain). If you are using a self-hosted version of n8n, please ensure this package is installed.

2. Telegram Account:

  • A Telegram bot created via the BotFather, along with its API token.

3. Google Gemini AI Account:

  • A Google Cloud account with the Vertex AI API enabled and an associated API Key.

4. Pinecone Account:

  • A Pinecone account with an API key.
  • You must have a vector index created in Pinecone. For use with Google Gemini's embedding-001 model, the index must be configured with 768 dimensions.

Setup Instructions

1. Telegram Configuration:

  • In the "Telegram Message Trigger" node, create a new credential and add your Telegram bot's API token.
  • Do the same for the "Telegram Response" and "Telegram Response about Database" nodes.

2. Pinecone Configuration:

  • In both "Pinecone Vector Store" nodes, create a new credential and add your Pinecone API key.
  • In the "Index" field of both nodes, enter the name of your pre-configured Pinecone index (e.g., telegram).

3. Google Gemini Configuration:

  • In all three Google Gemini nodes (Embeddings Google Gemini, Embeddings Google Gemini1, and Google Gemini Chat Model), create a new credential and add your Google Gemini (Palm) API key.

4. Activate and Use:

  • Save the workflow and toggle the "Active" switch to ON.
  • To use: First, send a PDF document to your bot. Wait for the confirmation message. Then, you can start asking questions about the content of that PDF.

Connect with us

For Custom Workflow Automation

Click here- Get Started

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 2 - Recursive Character Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 3 - Stop and Error

Type / Role
n8n-nodes-base.stopAndError - stopAndError
Config choices
Version 1

Block 4 - Question and Answer Chain

Type / Role
@n8n/n8n-nodes-langchain.chainRetrievalQa - chainRetrievalQa
Config choices
Version 1.3

Block 5 - Vector Store Retriever

Type / Role
@n8n/n8n-nodes-langchain.retrieverVectorStore - retrieverVectorStore
Config choices
Version 1

Block 6 - Pinecone Vector Store1

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1

Block 7 - Check If is a document

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2

Block 8 - Change to application/pdf

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Telegram get File

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 10 - Telegram Response

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 11 - Telegram Response about Database

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 12 - Stop and Error1

Type / Role
n8n-nodes-base.stopAndError - stopAndError
Config choices
Version 1

Block 13 - Pinecone Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1

Block 14 - Limit to 1

Type / Role
n8n-nodes-base.limit - limit
Config choices
Version 1

Block 15 - Embeddings Google Gemini

Type / Role
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini - embeddingsGoogleGemini
Config choices
Version 1

Block 16 - Embeddings Google Gemini1

Type / Role
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini - embeddingsGoogleGemini
Config choices
Version 1

Block 17 - Google Gemini Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 18 - Telegram Message Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.1

Block 19 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 25 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Automate a 'Chat with your PDF' Bot on Telegram with Google Gemini & Pinecone
Complexity advanced
Nodes 25
Categories Document Extraction, AI RAG
Author Intuz
Published 23 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10077/10077.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate a 'Chat with your PDF' Bot on Telegram with Google Gemini & Pinecone do?

This n8n template from Intuz provides a complete solution to automate a powerful, AI driven 'Chat with your PDF' bot on Telegram. It uses Retrieval Augmented Generation (R...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI RAG use case.