Skip to main content

Create a multi-modal Telegram support bot with GPT-4 and Supabase RAG

Workflow preview

Workflow preview
100%
Create a multi-modal Telegram support bot with GPT-4 and Supabase RAG preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

What It Does This n8n workflow turns your Telegram bot into a smart, multi modal AI assistant that accepts text , documents , images , and audio messages, interprets them using OpenAI models, an...

Best for

  • Support Chatbot automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.telegramtrigger, n8n-nodes-base.telegram, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.extractfromfile, n8n-nodes-base.switch, n8n-nodes-base.httprequest

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Ezema Kingsley Chibuzo.

Original n8n.io source

1.1 Workflow description

Title
Create a multi-modal Telegram support bot with GPT-4 and Supabase RAG
Workflow name
Create a multi-modal Telegram support bot with GPT-4 and Supabase RAG

🧠 What It Does

This n8n workflow turns your Telegram bot into a smart, multi-modal AI assistant that accepts text, documents, images, and audio messages, interprets them using OpenAI models, and responds instantly with context-aware answers. It integrates a Supabase vector database to store document embeddings and retrieve relevant information before sending a prompt to OpenAI β€” enabling a full RAG experience

πŸ’‘ Why This Workflow?

Most support bots can only handle basic text input. This workflow:

  • Supports multiple input formats (voice, documents, images, text)
  • Dynamically extracts and processes data from uploaded files
  • Implements RAG by combining user input with relevant memory or vector-based context
  • Delivers more accurate, relevant, and human-like AI responses.

πŸ‘€ Who It's For

  • Businesses looking to automate support using Telegram
  • Freelancers or solopreneurs offering AI Chatbots for businesses.
  • Creators building AI-powered bots for real use cases as it's great for Customer support knowledge, Legal or Policy document, long FAQs, Project documentation, and Product information retrieval.
  • Devs or analysts exploring AI + multi-format input + vector memory.

βš™οΈ How It Works

πŸ—‚οΈ Knowledge Base Setup

Run the β€œAdd to Supabase Vector DB” workflow manually to upload a document from your google drive and embed it into your vector database. This powers the Telegram chatbot’s ability to answer questions using your content.

πŸ” Telegram Message Routing

  1. Telegram Trigger captures the user message (Text, Image, Voice, Document)
  2. Message Router routes input by type using a Switch node
  3. Each type is handled separately:
    • Voice β†’ Translate recording to text (.ogg, .mp3)

    • Image β†’ Analyze image to text.

    • Text β†’ Sent directly to AI Agent (.txt).

    • Document β†’ Parsed (e.g. .docx to .txt) accordingly.

      πŸ“Ž Document Type Routing

      Before routing documents by type, the Supported Document File Types node first checks if the file extension is allowed. If not supported, it exits early with an error message β€” preventing unnecessary processing.

Supported documents are then routed using the Document Router node, and converted to text for further processing.

   #### Supported Document File Types
   **.jpg**   **.jpeg**   **.png**   **.webp**   **.pdf**   **.doc**   **.docx**   **.xls**   **.xlsx**   **.json**   **.xml**.
  1. The text content is combined with stored memory and embedded knowledge using a RAG approach, enabling the AI to respond based on real uploaded data.

    🧠 RAG via Supabase

    Uploaded documents are vectorized using OpenAI Embeddings. Embeddings are stored in Supabase with metadata. On new questions, the chatbot:

    • Extracts question intent
    • Queries Supabase for semantically similar chunks
    • Ranks retrieved chunks to find the most relevant match.
    • Injects them into the prompt for OpenAI.
    • OpenAI generates a grounded response based on actual document content.
  2. Response is sent to the Telegram user with content awareness.

πŸ›  How to Set It Up

  1. Open n8n or your local/self-hosted instance.
  2. Import the .json workflow file.
  3. Set up these credentials:
    • Google drive API Key
    • Telegram API (Bot Token) Guide
    • OpenAI API
    • Supabase API Key + Environment
    • ConvertAPI API Key
    • Postgres API Key
    • Cohere API Key
    • Add a prompt suited to your business. Add a custom AI agent prompt that reflects your business domain, tone, and purpose. This is very important. Without it, your agent won't know how best to respond.
  4. Activate the workflow.
  5. Start testing by sending a message or document to your Telegram bot.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Telegram Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.2

Block 2 - Telegram

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 3 - Download Audio

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 4 - Translate to Text

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 5 - Download PDF

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 6 - Download Image

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 7 - Fix mimeType

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Download Photo

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 9 - Fix mimeType1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - Photo to text

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 11 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 12 - Download Spreadsheet

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 13 - Extract from PDF

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 14 - Extract from Spreadsheet

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 15 - Typing…

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 16 - Supported Document File Types

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Group Similar Documents

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 18 - Input Message Router

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 19 - Document Router

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 20 - Download JSON

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 21 - Extract from JSON

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 22 - Download XML

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 23 - Extract from XML

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 24 - Download Word Document

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Showing the first 24 of 51 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Create a multi-modal Telegram support bot with GPT-4 and Supabase RAG
Complexity advanced
Nodes 51
Categories Support Chatbot, AI RAG
Author Ezema Kingsley Chibuzo
Published 02 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5589/5589.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Create a multi-modal Telegram support bot with GPT-4 and Supabase RAG do?

What It Does This n8n workflow turns your Telegram bot into a smart, multi modal AI assistant that accepts text , documents , images , and audio messages, interprets them using OpenAI models, an...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot, AI RAG use case.