This template is built for developers, researchers, and automation builders who want to create a document Q&A system — without the complexity of vector databases, embeddings, or chunking pipelines.
It's perfect for:
Traditional RAG systems require converting text into vectors, storing them in a vector database, and relying on semantic similarity to retrieve relevant chunks. This approach has known weaknesses:
PageIndex solves this differently. Instead of vectors, it builds a hierarchical tree index (like a Table of Contents) from your PDF using an LLM. At query time, the LLM reasons over that tree — identifies the most relevant sections, retrieves only those, and generates a precise, cited answer.
No embeddings. No vector DB. No chunking.
This n8n template delivers a fully working Telegram-based RAG bot with two independent flows in a single workflow:
📄 Flow 1 → PDF Knowledge Upload (Run Once per Document)
Send a PDF file to your Telegram bot. The workflow downloads it and uploads it to PageIndex cloud, where the tree index is built automatically.
💬 Flow 2 → Q&A Chat (Runs Every Time)
Send any question as a text message to the same Telegram bot. The workflow fetches all your indexed documents, sends the question to PageIndex's LLM reasoning engine, and delivers a cited answer back to your Telegram chat.
file_id.POST /doc/. PageIndex builds a hierarchical tree index (TOC with LLM-generated summaries per section). Returns a doc_id. No vectors are created.GET /docs on PageIndex to retrieve all previously uploaded documents.doc_id strings.doc_ids to PageIndex POST /chat/completions. PageIndex's LLM traverses the tree, identifies the relevant nodes, retrieves the raw text, and generates an answer with page citations.chat_id./newbot and follow the promptsYOUR_PAGEINDEX_API_KEY in these three nodes:
☁️ Index PDF on PageIndex📚 Fetch All Indexed Documents🧠 LLM Reasoning over Document TreeBoth Telegram Trigger nodes and the Telegram send node use the same credential. Set your Telegram API credentials once and n8n will apply them across all nodes automatically.
| Service | Where to Get | Used In |
|---|---|---|
| Telegram Bot Token | @BotFather on Telegram | All Telegram nodes |
| PageIndex API Key | API Key From Dashboard | Upload + Chat nodes |
doc_id). The Q&A flow automatically fetches all of them and reasons across all documents simultaneously.LLM Reasoning over Document Tree node, adjust "temperature": 0.5 for more creative (higher) or more precise (lower) answers."enable_citations": true/false in the chat node body to control whether page references appear in answers.Extract Document IDs node to filter only documents with status: completed or by name to limit which docs are queried.PageIndex is an open-source vectorless RAG framework by VectifyAI. It powers the Mafin 2.5 financial assistant which achieved 98.7% accuracy on FinanceBench - significantly outperforming GPT-4o (~31%) on document-intensive tasks.
Feel free to reach out via the n8n Community Forum or check out more automation templates on AppStoneLab Technologies.