How to group Telegram messages for a few seconds before replying with conversational logic?

Hi everyone,
I’ve been looking for a solution to this for a few days without any luck, so I’m turning to the forum to see if anyone can help.

I’m trying to create a flow in n8n for a Telegram bot that can hold a more natural, human-like conversation.
The issue is that bots usually reply immediately to each message they receive, but humans often write a single phrase split into multiple messages, like:

  • “Hi” [sent]
  • “How are you?” [sent]
  • “All good.” [sent]

And the bot responds to each one separately, which breaks the natural flow of the conversation.
What I’m trying to achieve is a system that, upon receiving a message from the same user ID, waits around 10 seconds, collects all messages sent during that window, merges them into a full phrase, and then processes that phrase to respond more coherently.

Has anyone managed to do something similar?
Any ideas on how this could be approached with n8n?

Thanks in advance!

Hi,

I haven’t seen this before, but I guess this would be technically possible.

In essence,

  1. you would collect input from multiple triggers, store them somewhere external (as each message is a new execution, this would be the only way to combine them later)

  2. on your scheduled interval, you read the messages and group them by chat id

  3. do something with the information

  4. send a response.

reg,
J.

1 Like

I finally got it. Here’s the flow if you’re interested, and if you have any questions, don’t hesitate to ask! Thanks for your advice.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.