Telegram Chatbot With MESSAGE BATCHING
Made this TG workflow with Message Batching for the cases when clients send more than one message within 30 seconds. LLM receives them in one string.
IMPORTANT: will not work on Manychat because Manychat HTTP requests timeout after 10 seconds. But if you use META App approach, it will def work for Instagram, Whatsapp and FB messages
It uses two Google Sheets:
  • Message Retention (date | user_id | message) — queues incoming messages.
  • Message Checkup (user_id | is_waiting | last_updated) — debounces per user.
Flow per message:
  1. Log to Message Retention.
  2. Read Message Checkup for that user_id. If empty, synthesize { is_waiting:false }.
  3. IF (OR):last_updated is older than 30s, oris_waiting is false→ Start wait window: set is_waiting=true, update last_updated, Wait (e.g., 30s).
  4. After Wait: fetch all queued messages for the user, merge them, delete those rows, send one AI answer to Telegram, then clear the Waiting row.
  5. If a new message arrives while waiting, we only refresh last_updated (extend the window) — we do not start another wait.
Copy/paste:
  • Older-than-30s: {{ new Date(Date.now() - 30000).toISOString() }}
  • “No Rows” normalizer (Code node) ensures the IF always has data to check.
Supports text and voice (voice via Whisper). Works reliably on Telegram once the webhook is registered and Sheets are shared with the service account.
0
0 comments
Kirill Zolygin
3
Telegram Chatbot With MESSAGE BATCHING
AI Automation Society
skool.com/ai-automation-society
A community for mastering AI-driven automation and AI agents. Learn, collaborate, and optimize your workflows!
Leaderboard (30-day)
Powered by