🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Telegram + Supabase: instant answers from your docs

Lisa Granqvist Partner Workflow Automation Expert

Your support inbox is full of repeat questions, but the answers live in ten different places. Someone pings you in Telegram, then you’re hunting PDFs, scrolling docs, and trying to stay consistent while you type the same reply again.

This hits support leads hardest, honestly. But founders and agency operators building bots for clients feel it too. With this Telegram docs answers automation, your bot can reply in seconds using your real documentation, even when users send screenshots, PDFs, or voice notes.

Below you’ll see how the workflow routes each message type, pulls the right context from Supabase, and sends on-brand answers back through Telegram.

How This Automation Works

Here’s the complete workflow you’ll be setting up:

n8n Workflow Template: Telegram + Supabase: instant answers from your docs

Why This Matters: Support Answers That Don’t Drift

Support is one of those jobs where “just answer it quickly” sounds easy until you do it all day. The same pricing question shows up again. Someone sends a blurry screenshot of an error. Another person drops a PDF and says “what does section 4 mean?” You can respond, sure, but the mental load is brutal, and tiny inconsistencies creep in. One teammate quotes an old policy. Another uses the wrong link. A week later you’ve got a mess: confused customers, longer threads, and less time for the work that actually moves the business.

It adds up fast. Here’s where the friction usually shows up.

  • Answers change depending on who’s replying, which quietly erodes trust over time.
  • Files get ignored because opening, reading, and summarizing them takes too long during busy hours.
  • Voice notes and screenshots force you into “manual translation” mode before you can even start helping.
  • Even a decent chatbot fails once questions require context from your actual docs, policies, or knowledge base.

What You’ll Build: A Telegram Bot That Answers From Your Knowledge Base

This workflow turns Telegram into a practical support front door. A message comes in (text, voice, image, or document), and the workflow routes it to the right handler. Audio gets transcribed into text. Images and photos get analyzed so the bot can “read” what’s shown. Documents like PDFs, spreadsheets, JSON/XML, and Word files are parsed or converted into text. Then the workflow uses your Supabase vector database to retrieve relevant chunks of your documentation, combines that context with the user’s question, and asks OpenAI to generate a grounded reply. Finally, the answer is sent back to Telegram, in the tone you define.

The workflow starts with a Telegram trigger and a message router that separates each input type. Next, content is normalized into plain text and enriched with retrieved context from Supabase (plus conversation memory). The AI agent produces a consistent response, and Telegram delivers it immediately.

What You’re Building

Expected Results

Say your team handles about 20 Telegram questions per day, and roughly half include a file (PDF, screenshot, or voice note). Manually, it’s easy to spend about 10 minutes per question between opening attachments, searching docs, and crafting a clean reply, so that’s around 3 hours daily. With this workflow, you spend maybe 1 minute reading the question while the bot transcribes/extracts and pulls context from Supabase. You get back about 2 hours a day, without pushing customers to a clunky ticket portal.

Before You Start

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Telegram for receiving messages and sending replies.
  • Supabase to store embeddings and run vector search.
  • OpenAI API key (get it from your OpenAI dashboard).

Skill level: Intermediate. You’ll connect a few credentials, paste API keys, and edit prompts, but you don’t need to write an app.

Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).

Step by Step

A Telegram message comes in. The Telegram trigger captures the user’s text, file, or voice note. The workflow also sends a “typing” action so the experience feels responsive while processing happens.

The message is routed and normalized. A Switch node routes by input type, then the workflow extracts usable text: voice is transcribed, PDFs and spreadsheets are parsed, Word files are converted, and images/photos are analyzed to produce a text description.

Your knowledge base is searched. The AI agent runs a retrieval step against Supabase vector search, often with a reranker involved, so only the most relevant chunks of documentation are used as context. Conversation memory can also be included so repeat users don’t have to restate everything.

An answer is generated and sent back. OpenAI produces a response grounded in the retrieved doc snippets, and the workflow posts the reply into the same Telegram chat thread.

You can easily modify the agent prompt to match your brand voice, escalation rules, and what sources it’s allowed to cite. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Telegram Trigger

This workflow begins when a Telegram message arrives and immediately runs two branches in parallel.

  1. Add and open Telegram Message Trigger.
  2. Credential Required: Connect your telegramApi credentials.
  3. Set Updates to message.
  4. Confirm parallel execution: Telegram Message Trigger outputs to both Route Incoming Message and Send Typing Action in parallel.
Tip: Parallel execution ensures users see a typing indicator while files are being processed.

Step 2: Connect Telegram File Fetch and Routing

Messages are categorized into text, voice, photo, or document, then routed to the correct fetch nodes.

  1. Open Route Incoming Message and verify the four outputs: Text, Audio, Photo, and Document, each checking {{$json.message.text}}, {{$json.message.voice}}, {{$json.message.photo}}, and {{$json.message.document}}.
  2. Credential Required: Connect your telegramApi credentials to all Telegram file nodes (Fetch Voice File, Fetch Photo File, Fetch Image File, Fetch PDF File, Fetch Word File, Fetch Spreadsheet File, Fetch JSON File, Fetch XML File, and Send Typing Action).
  3. Set Send Typing ActionOperation to sendChatAction and Chat ID to {{$json.message.chat.id}}.
  4. In each fetch node, keep Resource set to file and ensure the correct File ID expression is used (for example, {{$json.message.document.file_id}} in document nodes).
⚠️ Common Pitfall: If you forget to connect telegramApi credentials to all Telegram nodes, some file types will fail silently while others work.

Step 3: Set Up Document Validation and Type Routing

Document uploads are validated and categorized before file-specific parsing begins.

  1. Configure Check Document Extensions to keep the supported list in the code: ['.jpg', '.jpeg', '.png', '.webp', '.pdf', '.doc', '.docx', '.xls', '.xlsx', '.json', '.xml'].
  2. In Validate File Support, ensure the conditions check {{$json.is_supported}} is true and {{$json.reason}} equals supported_file_type.
  3. Confirm the success path routes to Categorize Documents and the failure path routes to Map Error Message.
  4. Review Categorize Documents to ensure it sets fileTypeCategory to image, pdf, word document, spreadsheet, json, or xml file.
  5. Confirm Route Document Types sends each category to the correct fetch node (e.g., ImageFetch Image File).

Step 4: Set Up File Parsing and Normalization

Each file type is normalized and converted into text for the assistant.

  1. For images, keep Normalize Image Mime and Normalize Photo Mime code unchanged so the mimeType is set correctly before analysis.
  2. Verify Parse PDF Text uses Operation pdf, Parse Spreadsheet Data uses xlsx, Parse JSON Content uses fromJson, and Parse XML Content uses xml.
  3. Ensure Convert File to Base64 uses Operation binaryToPropery prior to Docx to Text API.
  4. In Docx to Text API, set URL to https://v2.convertapi.com/convert/docx/to/txt and keep the JSON body expression intact.
  5. Replace the Authorization header in Docx to Text API with your ConvertAPI token (currently [CONFIGURE_YOUR_TOKEN]).
  6. Set Retrieve Text OutputURL to {{$json.Files[0].Url}} so the converted text is fetched.
⚠️ Common Pitfall: The ConvertAPI request will fail unless you replace [CONFIGURE_YOUR_TOKEN] with a valid token.

Step 5: Set Up AI Processing and Knowledge Base

This step wires up the AI analysis, embeddings, vector storage, and the assistant agent.

  1. Credential Required: Connect your openAiApi credentials to Transcribe Audio, Analyze Photo Content, Analyze Uploaded Image, and OpenAI Chat Model.
  2. Set Analyze Photo Content text to Describe the contents of this photo/image and Analyze Uploaded Image text to Describe the content of this image..
  3. For text mapping, keep the following nodes feeding Knowledge Base Assistant: Map Text Field, Map PDF Text, Map Doc Text, Map Spreadsheet Text, Map JSON Text, Map XML Text, and Compose Photo Text.
  4. In Compose Photo Text, keep the text value as =Photo content: {{$json.content}} Photo caption: {{$('Telegram Message Trigger').item.json.message.caption}}.
  5. Open Knowledge Base Assistant and set Text to {{$json.text}}.
  6. Connect AI sub-nodes to Knowledge Base Assistant and ensure credentials are added on the parent nodes: OpenAI Chat Model (language model), Postgres Conversation Memory (memory), and Supabase Vector Search (tool). Do not add credentials to these sub-nodes directly.
  7. Credential Required: Connect your postgres credentials to Postgres Conversation Memory and keep Session Key as {{$('Telegram Message Trigger').item.json.message.chat.id}}.
  8. Credential Required: Connect your cohereApi credentials to Cohere Reranker and your supabaseApi credentials to Supabase Vector Search and Insert Into Supabase Vectors.
Tip: Supabase Vector Search is attached as an AI tool to Knowledge Base Assistant, and Cohere Reranker improves results via the AI reranker connection.

Step 6: Connect the Knowledge Base Ingestion Path

The workflow includes a manual ingestion pipeline to load knowledge documents into Supabase vectors.

  1. Open Manual Execution Start to confirm this path runs only when manually executed.
  2. In Retrieve Drive File, set Operation to download and replace File ID [YOUR_ID] with your knowledge base file.
  3. Credential Required: Connect your googleDriveOAuth2Api credentials to Retrieve Drive File.
  4. In Default Data Loader, set Data Type to binary and Text Splitting Mode to custom.
  5. Confirm Recursive Text Splitter feeds Default Data Loader, and Generate Embeddings connects to Insert Into Supabase Vectors.
⚠️ Common Pitfall: If you skip the manual ingestion run, Supabase Vector Search will have no data to retrieve for the assistant.

Step 7: Configure Output Delivery

The assistant’s final output is sent back to the user in Telegram.

  1. Open Send Telegram Reply and set Text to {{$json.output}}.
  2. Set Chat ID to {{$('Telegram Message Trigger').item.json.message.chat.id}}.
  3. Credential Required: Connect your telegramApi credentials to Send Telegram Reply.

Step 8: Test and Activate Your Workflow

Validate each route, confirm AI responses, then enable the workflow for production use.

  1. Click Execute Workflow to test the manual ingestion path, then verify vectors are added through Insert Into Supabase Vectors.
  2. Send a Telegram message with text, voice, photo, and a supported document to ensure each branch reaches Knowledge Base Assistant.
  3. Confirm successful execution by receiving a Telegram response from Send Telegram Reply with relevant content.
  4. When tests pass, toggle the workflow to Active so Telegram Message Trigger runs in production.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Troubleshooting Tips

  • Telegram bot tokens get rotated or pasted incorrectly more often than you’d think. If replies stop, check the Telegram credential in n8n first, then confirm the bot can still message your chat.
  • If you’re using Wait-like timing (or external conversion services), processing times vary. Bump up the wait duration if downstream nodes fail on empty responses, especially for big PDFs or slow doc-to-text conversions.
  • Supabase vector search looks “broken” when the embeddings don’t match the same model or chunking strategy. If results are irrelevant, re-check your embedding settings, chunk sizes, and that your knowledge-base ingestion workflow actually inserted new vectors.

Quick Answers

What’s the setup time for this Telegram docs answers automation?

About 1–2 hours if your keys and Supabase project are ready.

Is coding required for this docs answers automation?

No. You’ll mostly connect credentials, paste API keys, and edit prompts. There is some light configuration around file handling, but it’s not “build a backend” work.

Is n8n free to use for this Telegram docs answers workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI usage (typically a few cents per conversation) plus any document conversion or reranking calls you enable.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I modify this Telegram docs answers workflow for different use cases?

Yes, and you should. You can swap what gets indexed by changing the Google Drive ingestion path (the manual “Retrieve Drive File” to “Insert Into Supabase Vectors” section), and you can reshape how the assistant behaves by editing the “Knowledge Base Assistant” agent prompt. Common tweaks include adding escalation rules (“hand off to a human”), restricting answers to specific collections, and changing the tone for sales vs. support.

Why is my Telegram connection failing in this workflow?

Usually it’s an invalid or rotated bot token in your Telegram credentials. It can also be chat permissions (the bot isn’t allowed to message that chat), or you’re testing in a different Telegram thread than the trigger is listening to. If the trigger works but replies don’t, verify the “Send Telegram Reply” node is pointing to the correct chat ID from the incoming message.

What volume can this Telegram docs answers workflow process?

If you self-host, there’s no execution cap, so it mostly depends on your server and API limits. On n8n Cloud, your plan sets the monthly execution allowance. Practically, this workflow handles support volume well, but large files and image analysis can slow throughput, so many teams start with “dozens per day” and scale up once prompts and indexing are dialed in.

Is this Telegram docs answers automation better than using Zapier or Make?

For RAG-style bots with multiple file types, n8n is usually the easier long-term choice. You get more flexible routing (Switch/If logic), better control over how files are parsed, and a clear path to self-host for unlimited runs. Zapier or Make can work for simple “message in, message out” flows, but once you add embeddings, reranking, and document conversion, you’ll feel their limits. The other factor is cost: multi-step AI workflows can get expensive fast on per-task pricing. Talk to an automation expert if you want help choosing based on your volume.

Once this is live, your Telegram bot stops guessing and starts answering from the same docs your team trusts. Set it up, tune the prompt, and enjoy the quiet.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal