Process Multiple Media Files in Telegram with Gemini AI & PostgreSQL Database - n8n Workflow | Neura Market

    Process Multiple Media Files in Telegram with Gemini AI & PostgreSQL Database

    # 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 - **Multi-file media group management** with PostgreSQL: - `media_group` - `media_queue` - `chat_histories` - **Document parsing** for CSV, HTML, ICS, JSON, ODS, PDF (with AI fallback), RF, X, XML, and spreadsheets. - **Voice & video transcription** for AI analysis. - **Image, audio, and video description** for richer AI context. - **Telegram-safe MarkdownV2 formatting** with auto-splitting for messages over 4096 chars. - **Error fallback** for unsupported file types. --- ## 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](https://n8n.io/workflows/5589-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: - Handle **multiple files sent in a single message** (albums, multiple PDFs, etc.). - Extract & analyze **content from many file formats**. - Transcribe **voice and video messages**. - Maintain **chat memory** for contextual AI answers. - Avoid **Telegram formatting errors** and length limit issues. This workflow automates the full chain: **Receive → Process → AI Analysis → Telegram-safe Reply**. --- ## Example User Interactions - **Multiple PDFs with a caption** → AI extracts and summarizes all PDFs in one combined reply. - **Voice message** → AI transcribes and replies with a contextual answer. - **CSV or spreadsheet file** → AI parses and summarizes the data. - **Multiple images** → AI describes each image and replies in a single message. --- ## Required Credentials - **Telegram Bot API** (Bot Token) - **PostgreSQL** (Connection credentials) - **AI Provider API** (OpenAI, Google Gemini, or compatible LLM) --- ## 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 - **Green section** ensures only one trigger per media group. - **Yellow section** guarantees captions and files are stored in the correct sequence. - **Purple section** formats AI output to be Telegram-safe and split if needed. - AI prompt is **not fixed**, allowing full customization. --- ## Need Assistance? If you'd like help customizing or extending this workflow, feel free to reach out: - Email: [johnsilva11031@gmail.com](mailto:johnsilva11031@gmail.com) - LinkedIn: [John Alejandro Silva Rodríguez](https://www.linkedin.com/in/john-alejandro-silva-rodriguez-48093526b/)

    Platform
    n8n
    Category
    AI
    Price
    Free
    Creator
    John Alejandro SIlva
    • if
    • set
    • code
    • html
    • wait
    • merge
    • switch
    • postgres
    • telegram
    • aggregate
    Back to MarketplaceMore n8n Workflows

    How to import this workflow into n8n

    1. 1Purchase or download the workflow to get the n8n workflow JSON file.
    2. 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
    3. 3Open each node marked with a credential warning and connect your own accounts and API keys.
    4. 4Run the workflow once manually to verify the data flow, then toggle it to Active.

    Related AI workflows

    • Launch Your First AI-Powered Chatbot with Actionable ToolsFree
    • Automate AI Video Creation and YouTube Upload with Google Sheets
    Free
  1. Build a WhatsApp Assistant with Memory, Google Suite, Multi-AI, Research, and ImagingFree
  2. Automate Blog Post Creation and Publishing with GPT, Leonardo AI, and WordPressFree
  3. Email Agent$500.99
  4. Create a Conversational Telegram Bot with GPT-4 for Text and Voice MessagesFree
  5. More from John Alejandro SIlva

    • Cheaper, Faster, Accurate Answers with Memory Summarization & Dynamic Routing!
    • Nutrition Tracker & Meal Logger with Telegram, Gemini AI, and Google Sheets
    All AI workflows →All n8n workflows →

    Need help customizing this workflow?

    Our automation experts adapt it to your exact stack, data, and process — or build one from scratch.

    Get a Custom Build
    Neura Market
    Neura Market
    Marketplace
    Directories
    Resources

    Marketplace

    • Prompts
    • Workflows
    • Agents Store
    • Workflow Packs
    • Categories
    • Marketplace

    Directories

    • AI Tools Directory
    • ChatGPT
    • Claude
    • Gemini
    • Cursor
    • Grok
    • DeepSeek
    • Perplexity
    • CoPilot
    • Midjourney
    • Stable Diffusion
    • MCP Servers
    • .md Directory
    • All Directories

    Free Tools

    • AI Text Humanizer
    • AI Content Detector
    • Workflow Generator
    • Model Comparison
    • AI Pricing Calculator
    • AI Benchmarks
    • ROI Calculator
    • All Free Tools

    Resources

    • AI News
    • Blog
    • AI Models
    • Integrations
    • Alternatives
    • n8n vs Zapier
    • Make vs Zapier
    • n8n vs Make
    • Resource Library
    • Documentation

    Community

    • AI Jobs
    • AI Events
    • AI Companies
    • Start Selling
    • Sell n8n Workflows
    • Sell AI Agents
    • Sell Prompts
    • Creator Guide
    • Advertise
    • Affiliates

    Company

    • About
    • Contact
    • Help
    • Careers
    • Pricing
    • Terms
    • Privacy
    • License
    • DMCA

    Stay Updated

    Get the latest AI tools and insights delivered to your inbox.

    Neura Market Logoneuramarket

    © 2026 Neura Market. All rights reserved.