AI Document Assistant via Telegram + Supabase

This workflow transforms a Telegram bot into an intelligent document assistant. Users can upload PDF documents via Telegram, and the system automatically parses them to generate semantic vectors, which are stored in a Supabase database for easy intelligent retrieval and Q&A. The bot utilizes a powerful language model to answer complex questions in real-time, supporting rich HTML format output and automatically splitting long replies to ensure clear information presentation. Additionally, it integrates a weather query feature to enhance user experience, making it suitable for personal knowledge management, corporate assistance, educational tutoring, and customer support scenarios.

Workflow Diagram
AI Document Assistant via Telegram + Supabase Workflow diagram

Workflow Name

AI Document Assistant via Telegram + Supabase

Key Features and Highlights

This workflow transforms a Telegram bot into a dedicated AI document assistant. Users can upload PDF documents via Telegram, and the system automatically parses the file content, generates semantic vectors (embeddings), and stores them in a Supabase vector database to enable intelligent document retrieval and Q&A. Leveraging the powerful language understanding and generation capabilities of Google Gemini, the bot can provide real-time answers to complex questions based on the uploaded documents. It supports rich HTML-formatted output and automatically splits long replies to ensure optimal display within Telegram. Additionally, it integrates the OpenWeatherMap API to provide real-time weather information.

Core Problems Addressed

  • Low efficiency and inconvenience in traditional document lookup and information retrieval.
  • Conventional chatbots lack understanding of user-owned document knowledge.
  • Difficulty in sending long text replies completely due to Telegram message length limits.
  • Need for a no-code solution to quickly build an intelligent document Q&A bot.

Application Scenarios

  • Personal Knowledge Management: Convert personal or work-related PDF documents into a conversational knowledge base.
  • Enterprise Internal Assistant: Employees upload training materials and manuals, then quickly retrieve needed information via chatbot.
  • Educational Support: Students upload textbooks or lecture notes for assisted learning and Q&A through the bot.
  • Customer Support: Integrate product manuals or FAQ documents to enable intelligent automated responses.

Main Workflow Steps

  1. Users send messages or upload PDF documents to the bot via Telegram.
  2. The bot receives messages through the “Telegram Trigger” node; command routing determines the message type (text or document).
  3. For documents, the bot downloads and extracts the PDF text content.
  4. Google Gemini generates semantic vectors (embeddings) for the extracted text.
  5. Vectors and text content are stored in the Supabase vector database to build the knowledge base.
  6. Upon user queries, the bot performs vector search to find the most relevant document segments.
  7. Google Gemini generates detailed answers based on the context; results are cleaned and segmented with HTML formatting.
  8. The bot sends replies as multiple Telegram messages, supporting formatted display.
  9. (Optional) When users inquire about weather, the bot calls the OpenWeatherMap API to return real-time weather data.

Involved Systems and Services

  • Telegram Bot API (user interaction interface)
  • Google Gemini API (large language model responsible for text generation and embeddings)
  • Supabase (hosted vector database storing documents and their semantic representations)
  • OpenWeatherMap API (optional, for real-time weather data)
  • n8n (no-code workflow automation platform orchestrating the entire process)

Target Users and Value Proposition

  • Users who need to rapidly build intelligent Q&A bots based on personal or enterprise documents without coding.
  • Individuals or teams seeking convenient access to complex document content via chat interfaces.
  • Educational, customer support, and knowledge management scenarios aiming to improve document information access efficiency and user experience.
  • Users with high data privacy requirements, as documents are stored in their own Supabase instance ensuring information security.

This workflow fully leverages n8n’s powerful integration capabilities, combining Google Gemini’s AI intelligence with Supabase’s efficient vector search to create a comprehensive, responsive Telegram document assistant. It achieves seamless connectivity from document upload to intelligent Q&A, significantly enhancing document utilization and user interaction experience.