πŸ’¬ Process multiple media files in Telegram with Gemini AI & PostgreSQL database

⚑ 10,045 views Β· πŸ’¬ Support Chatbots

Description

πŸ€–πŸ“¨ Telegram AI Assistant with Multi-File Media Group Handling, Smart File Processing & PostgreSQL Integration

> AI-powered Telegram bot for text, voice, video, documents & media β€” with database-driven grouping and Telegram-safe formatting.


πŸ“‹ Description

This n8n template creates a next-generation Telegram AI assistant πŸ§ πŸ’¬ capable of handling text messages, media files, and documents with advanced processing, PostgreSQL integration, and AI-powered responses.

It is designed to solve Telegram’s media group challenge πŸ“¦ β€” when multiple files are sent together, they are stored, processed, and combined into one coherent AI-generated reply.

✨ Key Features


πŸ’‘ Acknowledgment

A huge thank you to Ezema Gingsley Chibuzo πŸ™Œ for the inspiration of the first version of this workflow:
Create a Multi-Modal Telegram Support Bot with GPT-4 and Supabase RAG
Your pioneering work laid the foundation for this improved, database-powered multi-modal assistant πŸš€


🏷 Tags

telegram ai-assistant postgresql multi-file media-group
file-processing voice-transcription document-parser pdf-extraction
markdown-formatting n8n-template


πŸ’Ό Use Case

Use this template if you need an AI-powered Telegram bot that can:

This workflow automates the full chain: Receive β†’ Process β†’ AI Analysis β†’ Telegram-safe Reply.


πŸ’¬ Example User Interactions


πŸ”‘ Required Credentials


βš™οΈ Setup Instructions

  1. πŸ—„οΈ Create the PostgreSQL tables (Gray section SQL):
    • media_group
    • media_queue
    • chat_histories
  2. πŸ”Œ Configure the Telegram Trigger with your bot token.
  3. πŸ€– Connect your AI provider credentials.
  4. πŸ—‚οΈ Set up PostgreSQL credentials in the database nodes.
  5. ▢️ Deploy the workflow in n8n.
  6. 🎯 Start sending messages and files to your bot.

πŸ“Œ Extra Notes


πŸ’‘ Need Assistance?

If you’d like help customizing or extending this workflow, feel free to reach out:

πŸ“§ Email: johnsilva11031@gmail.com
πŸ”— LinkedIn: John Alejandro Silva RodrΓ­guez

πŸ”— Nodes Used

Postgres, Telegram, Telegram Trigger, Postgres Trigger, AI Agent, Extract from File

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup