PDF Learning Buddy Bot Using Telegram
Effortlessly build a personalized Telegram-based learning assistant that ingests PDF documents and answers your questions with AI-powered knowledge retrieval.
This workflow enables a Telegram-based learning assistant bot that can receive messages and PDF documents, process their content, store and retrieve knowledge using vector embeddings, and answer user queries intelligently using AI. Users can send either a question or a PDF document to expand the bot's knowledge.

Documentation
Workflow Steps:
Telegram Trigger
- Starts when a user sends a message or PDF document via Telegram.
- Captures message text or document metadata.
Check If is a Document (If Node)
- Determines if the incoming message contains a PDF document.
- Routes the workflow based on message type (document vs question).
Telegram get File
- Downloads the PDF document from Telegram if present.
Change to application/pdf (Code Node)
- Ensures the file is properly formatted as a PDF.
- Updates metadata such as MIME type and file extension.
Default Data Loader
- Loads the content of the document for processing.
Recursive Character Text Splitter
- Splits the text into manageable chunks with overlap to preserve context.
Embeddings / Embeddings OpenAI
- Converts text chunks into vector embeddings for semantic search.
Pinecone Vector Store / Pinecone Vector Store1
- Stores embeddings in Pinecone for future retrieval.
Vector Store Retriever
- Searches the Pinecone database to find relevant information for user queries.
OpenAI Chat Model
- Processes queries with GPT-4.1-mini to generate AI responses.
Question and Answer Chain
- Combines retrieved context with AI model to answer user questions accurately.
Telegram Response
- Sends AI-generated answers back to the user.
Limit to 1
- Prevents duplicate messages by limiting output to a single item.
Telegram Response about Database
- Confirms the number of PDF pages saved to Pinecone.
Data Sources & Tools
- Telegram Bot → Receives messages and documents from users.
- OpenAI API → Generates embeddings and answers questions.
- Pinecone Vector Store → Stores and retrieves embeddings for AI queries.
- n8n → Orchestrates the workflow and node connections.
Key Benefits
- Automates learning support by answering questions and processing new documents.
- Efficiently manages PDF documents by splitting, embedding, and storing them for retrieval.
- Provides accurate, context-aware AI responses in Telegram chat.
