Use this robust n8n workflow to reliably capture full Telegram media groups (image albums), utilize an n8n Data Table for message queuing and stability, and process the resulting images and text via NanoBanana (Gemini) multimodal AI through the OpenRouter API.
Download this n8n workflow template and start using it instantly.
Handling image albums (media groups) in messaging apps like Telegram can be challenging in real-time automations, as individual messages arrive separately. This advanced n8n workflow solves this by implementing a caching layer using the built-in n8n Data Table.
When a user sends a media group, the Telegram n8n trigger captures each piece, storing it immediately as a 'new' record in the Data Table. A separate, scheduled n8n trigger then periodically checks the queue. It uses complex logic to wait a defined period (7 seconds) to ensure the entire album has arrived before merging all components and submitting the full context (images and caption) to a multimodal AI model (NanoBanana/Gemini via OpenRouter). This approach ensures reliability, even with slow internet connections, making this one of the most stable n8n templates for media processing.
The n8n workflow operates in two asynchronous paths:
photo).Filter1) to detect if a caption is present. If so, a Send initial notification is immediately sent to the user acknowledging receipt.Upsert row(s) n8n node then saves the message details (chatid, messageid, mediagroup, and the full JSON message) into the Data Table with the status 'new'.Schedule Trigger n8n trigger, configured to run every 5 seconds, checking the processing queue.If any new records exist in the Data Table using the rowExists operation.Get new requests retrieves all 'new' messages.Latest message in mediagroup identifies the timestamp of the last message in a group. The subsequent Filter n8n node ensures that the final message was received at least 7 seconds ago, confirming the album upload is complete.Merge n8n node combines all records belonging to the same media group ID.Get a file Telegram n8n node.prepare user messages) into a multimodal input array structure (text and image URLs).Summarize n8n node aggregates all prepared image and text inputs for a single group, forming the complete prompt for the AI.Call NanoBanana via OpenRouter n8n node sends this multimodal prompt to the Gemini model for processing. The model returns a generated image in Base64 format.Convert to File n8n node.Send result message Telegram n8n node, and the Data Table status is updated to 'done' using the final status:done n8n node.To deploy this powerful n8n workflow, follow these steps:
Telegram Trigger node and the Telegram nodes (Get a file, Send initial notification, etc.).Call NanoBanana via OpenRouter n8n node.Upsert row(s) n8n node:chatidmessageidmediagroupmessagestatusprepare user messages n8n node (Set node).https://api.telegram.org/file/bot/... with your actual Telegram bot token to ensure the multimodal AI can access the image files directly.mediagroupid and photo data are present in the Telegram update.mediagroup ID, allowing the full album to be processed together.Use this comprehensive n8n workflow to automate new Shopify order fulfillment: automatically update Zoho CRM, generate Harvest invoices, create Trello tasks, and send segmented customer emails using the powerful n8n node structure.

Automate Shopify lead processing using this advanced n8n workflow. It monitors Gmail, extracts lead data via regex parsing, and automatically creates or updates HubSpot Contacts and Deals.

Use this powerful n8n workflow to automatically process scanned invoices from Google Drive using OCR.space and OpenAI/LLM for structured data extraction into Google Sheets.

Automate testimonial collection, use GPT-4 for text enhancement, generate dynamic social media cards, and manage approval via Google Sheets using this powerful n8n workflow.

Automate Thai multi-page PDF processing using Typhoon OCR and LLMs. This n8n workflow extracts data, structures it, and saves the results to Google Sheets.

Use this powerful n8n workflow to automatically transcribe voice notes, analyze them using an OpenRouter AI agent (Claude Sonnet), archive the results in NocoDB, and document them immediately in Nuclino and Slack. This n8n templates accelerate knowledge management.








































