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
Most support bots can only handle basic text input. This workflow:
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 Trigger captures the user message (Text, Image, Voice, Document)
Message Router routes input by type using a Switch node
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.
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.
.jpg .jpeg .png .webp .pdf .doc .docx .xls .xlsx .json .xml.
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.
Uploaded documents are vectorized using OpenAI Embeddings. Embeddings are stored in Supabase with metadata. On new questions, the chatbot:
Response is sent to the Telegram user with content awareness.
.json
workflow file.