Templates / Allow users to send a sequence of messages to an AI agent in Telegram

Allow users to send a sequence of messages to an AI agent in Telegram

Needs changes

by Chris Carr ✓ · 13,041 views · created 2025-02-16 · Support Chatbot, AI Chatbot

Needs changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.

What to replace before upgrading

Removed in 3.0Replace with
AI Agent v1 (old agent modes)
AI Agent (v1.7)
Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.

Nodes used (11)

TelegramSupabaseOpenAI Chat ModelAI AgentPostgres Chat Memory

What it does

Use Case When creating chatbots that interface through applications such as Telegram and WhatsApp, users can often sends multiple shorter messages in quick succession, in place of a single, longer message. This workflow accounts for this behaviour. What it Does This workflow allows users to send several messages in quick succession, treating them as one coherent conversation instead of separate messages requiring individual responses. How it Works 1. When messages arrive, they are stored in a Supabase PostgreSQL table 2. The system waits briefly to see if additional messages arrive 3. If no new messages arrive within the waiting period, all queued messages are: - Combined and processed as a single conversation - Responded to with one unified reply - Deleted from the queue Setup 1. Create a table in Supabase called messagequeue. It needs to have the following columns: userid (uint8), message (text), and messageid (uint8) 2. Add your Telegram, Supabase, OpenAI, and PostgreSQL credentials 3. Activate the workflow and test by sending multiple messages the Telegram bot in one go 4. Wait ten seconds after which you will receive a single reply to all of your messages How to Modify it to Your Needs - Change the value of Wait Amount in the Wait 10 Seconds node in order to to modify the buffering window - Add a System Message to the AI Agent to tailor it to your specific use case - Replace the OpenAI sub-node to use a different language model

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.