← All N8N workflows
AI & researchAgentAggregateIfOpenAI Chat ModelMemory Postgres Chat

Telegram Chat with Buffering

Configured with Agent, Aggregate, OpenAI Chat Model, Memory Postgres Chat, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
MessagingReplyTelegramTriggerReceive MessageTelegram TriggerWaitWait 10 SecondsWaitData storeAdd to Queued MessagesSupabaseRoutingNo Operation, donothingNo OpTransformAggregateAggregateData storeDelete Queued MessagesSupabaseAI & modelsOpenAI Chat ModelOpenAI Chat ModelTransformSort by Message IDSortData storeGet Queued MessagesSupabaseRoutingCheck Most RecentMessageIfAI & modelsAI AgentAgentData storePostgres Chat MemoryMemory Postgres Chat

Node categories in this workflow

  • Messaging
  • Trigger
  • Wait
  • Data store
  • Routing
  • Transform
  • AI & models

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
ReplyMessagingTelegramSee node parameters
Receive MessageTriggerTelegram TriggerSee node parameters
Wait 10 SecondsWaitWaitSee node parameters
Add to Queued MessagesData storeSupabaseSee node parameters
No Operation, do nothingRoutingNo OpSee node parameters
AggregateTransformAggregateSee node parameters
Delete Queued MessagesData storeSupabasedelete
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
Sort by Message IDTransformSortSee node parameters
Get Queued MessagesData storeSupabasegetAll
Check Most Recent MessageRoutingIfSee node parameters
AI AgentAI & modelsAgentSee node parameters
Postgres Chat MemoryData storeMemory Postgres ChatSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • openAiApi
  • postgres
  • supabaseApi
  • telegramApi

Workflow notes

Allow Users to Send a Sequence of Messages to an AI Agent in Telegram with Supabase

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 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

Setup

  1. Create a table in Supabase called message_queue. It needs to have the following columns: user_id (uint8), message (text), and message_id (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
Modification

Modification

Change the value of Wait Amount to vary the buffering window

Modification

Modification

Replace this sub-node to use a different language model

Modification

Modification

Add a System Message to tailor the chatbot to your use case

Telegram Chat with Buffering

Telegram Chat with Buffering

Purpose and structure

This folder contains the Telegram Chat with Buffering workflow. Its executable nodes use agent, aggregate, if, lmChatOpenAi, memoryPostgresChat, noOp, sort, supabase, telegram, telegramTrigger, wait. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Receive Message

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Telegram/1411_Telegram_Wait_Automation_Triggered.json MIT; preserve source notices.

Canvas section labels

These name areas of the original canvas; they do not include explanatory instructions.

  • 1. Receive Message
  • 3. AI Assistant
  • 2. Buffer Incoming Messages
  • 4. Send Reply

More in AI & research