Buffer multiple Telegram messages for an AI agent
This n8n workflow lets users send several short Telegram messages in a row and has the AI agent answer them together as one request. It is for chatbot builders on Telegram or WhatsApp whose users type in bursts rather than one long message.
What it does
Each incoming message is added to a queue in Supabase and the workflow waits 10 seconds. If no newer message arrived, it sorts and aggregates the queued messages, deletes them from the queue, sends the combined text to an OpenAI chat model and replies once.
How to use it
Create the queued messages table in Supabase, then connect Telegram, Supabase and OpenAI.
Requirements and limits
Replies arrive after the 10 second wait.
More in Other and the n8n workflow library.
Full text
Front matter
name: Telegram Chat with Buffering
description: Triggered manually or by an app event. Connects Aggregate, Condition, Sort, Stop And Error, Supabase, Telegram, Wait. ## 1. Receive Message ## 3. AI Assistant ## 2. Buffer Incoming Messages ## 4. Send Reply ## Allow Users to Send a Sequence of Messages to an AI Agent in Telegram with Supabase ### 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 sever
category: Automation
kind: Workflow
software: Aggregate|Condition|Sort|Stop And Error|Supabase|Telegram|WaitTelegram Chat with Buffering
Triggered manually or by an app event. Connects Aggregate, Condition, Sort, Stop And Error, Supabase, Telegram, Wait. ## 1. Receive Message
## 3. AI Assistant ## 2. Buffer Incoming Messages ## 4. Send Reply
## Allow Users to Send a Sequence of Messages to an AI Agent in Telegram with Supabase
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 sever
Steps
- Sticky Note (stickyNote)
- Sticky Note1 (stickyNote)
- Reply (telegram)
- Receive Message (telegramTrigger)
- Wait 10 Seconds (wait)
- Sticky Note3 (stickyNote)
- Add to Queued Messages (supabase)
- No Operation, do nothing (noOp)
- Aggregate (aggregate)
- Delete Queued Messages (supabase)
- Sticky Note2 (stickyNote)
- OpenAI Chat Model (noOp)
- Sort by Message ID (sort)
- Get Queued Messages (supabase)
- Check Most Recent Message (if)
- AI Agent (noOp)
- Postgres Chat Memory (noOp)
- Sticky Note4 (stickyNote)
- Sticky Note5 (stickyNote)
- Sticky Note6 (stickyNote)
- Sticky Note8 (stickyNote)
- Sticky Note9 (stickyNote)
- Error Handler (stopAndError)
Import
Download the JSON from the GitHub source and import it in n8n (Workflows, Import from file).
Source and license
Author: Zie619, n8n workflow collection. License: MIT.
Shown here with formatting for the web. Keep the author and license notice when you reuse it.
Related entries
There are more like this in the members library
The n8n workflow library holds 1,814 entries. Members can search all of them by meaning and read every one in full.