workflows.fit
Back to n8n workflows
n8n template$30By Issam AGGOUR

Build a multi-functional Telegram bot with Gemini, RAG PDF search & Google Suite

The Ultimate Beginner's Guide to an AI-Powered Telegram Assistant (PDF, Brave search & Google Suite) This comprehensive workflow bundle is designed as a powerful starter kit, enabling you to build a multi-functional A...

DevelopmentCore NodesCommunicationHITLData & StorageProductivityMiscellaneousAI
Open checkout
Loading interactive preview...

Template notes

The Ultimate Beginner's Guide to an AI-Powered Telegram Assistant (PDF, Brave search & Google Suite)

This comprehensive workflow bundle is designed as a powerful starter kit, enabling you to build a multi-functional AI assistant on Telegram. It seamlessly integrates AI-powered voice interactions, an intelligent PDF document search using a Retrieval-Augmented Generation (RAG) system, and automates various Google Suite tasks like calendar management and document generation. Perfect for beginners looking to explore advanced AI and automation capabilities.

Disclaimer This template is designed for self-hosted n8n instances.

🚀 Key Features Telegram Bot Interface: Interact with your AI assistant using both text and voice commands through Telegram. AI Voice Bot: Transcribes user voice messages using OpenAI Whisper. Processes requests with an AI agent powered by Google Gemini. Responds with AI-synthesized voice using Replicate API. PDF RAG System: Index PDF documents from Google Drive via Telegram commands. Utilizes Mistral AI for Optical Character Recognition (OCR) on PDFs. Stores document content and embeddings in a Qdrant vector database. Answers questions about your documents using Google Gemini, based on retrieved context. Google Suite Automation: Manage Google Calendar: Create events, find upcoming holidays, and list birthdays. Google Drive: Search for PDF files and manage document templates. Google Docs: Automatically generate invoices from templates. Intelligent Web Search: Employs Brave Search for fetching real-time information from the web. Versatile AI Agent: Leverages Google Gemini with a suite of tools including a calculator, date & time utilities, and custom integrations (e.g., example Airbnb tools). Command-Driven Functionality: Easily trigger specific actions using Telegram commands like /help, /pdf, /rag, /invoice, /chat, /brave, and /birthday.

⚙️ How It Works The workflow is initiated by messages or commands sent to your Telegram bot. A central Switch node directs the flow based on the input received.

1. Telegram Interaction & Command Routing A Telegram Trigger node listens for new messages (text or voice). A "typing..." indicator is sent to Telegram for better user experience. The Switch node parses the message content and routes it to the appropriate sub-workflow based on predefined commands (e.g., /pdf, /rag, /voice) or general chat.

2. AI Voice Bot Functionality For voice messages (or if the voice path is triggered): The voice file is downloaded from Telegram. OpenAI Whisper transcribes the audio into text. The transcribed text is fed to an AI Agent (powered by Google Gemini and equipped with various tools and memory). The AI Agent's text response is then sent to the Replicate API to generate a natural-sounding voice. The generated audio response is sent back to the user on Telegram.

3. PDF RAG System with Mistral OCR & Qdrant Indexing PDFs (via /qdrant <GoogleDriveFileID> command): The specified PDF is downloaded from Google Drive. The PDF is uploaded to Mistral AI for OCR processing. The extracted text (in markdown format) is retrieved. The text is split into manageable chunks. OpenAI Embeddings are generated for each chunk. These chunks and their embeddings are stored in a Qdrant vector collection. A confirmation message is sent to Telegram. Querying PDFs (via /rag <yourquestion> command): The user's question is processed by a RetrievalQA Chain. This chain uses Google Gemini as the Language Model and retrieves relevant document chunks from Qdrant based on semantic similarity (embeddings). Google Gemini then generates a concise answer based on the user's question and the retrieved contextual information from the documents. The answer is sent back to the user on Telegram. Searching PDFs in Drive (via /pdf <searchterm> command): Searches your Google Drive for PDF files matching the provided search term. Sends a list of found PDF files (name and ID) to the user on Telegram, allowing them to easily identify files for indexing with /qdrant.