Templates / End of turn detection for smoother AI agent chats with Telegram and Gemini

End of turn detection for smoother AI agent chats with Telegram and Gemini

Ready for 3.0

by Jimleuk ✓ · 1,411 views · created 2025-06-17 · Support Chatbot, AI Chatbot

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

What this workflow does

This AI workflow has 23 nodes and runs on Telegram events (message) (plus 1 other trigger). Along the way it connects Telegram, Google Gemini Chat Model, Redis Chat Memory and Redis.

How it runs

Trigger: On Telegram events (message) (plus 1 other trigger).

  1. Is Bot command? (If): checks a condition and branches into true / false
  2. Get Session (Redis): get
  3. Get Values (Edit Fields (Set)): sets 3 fields: from, message, createdAt
  4. Update Session (Redis): set
  5. Call Prediction Subworkflow (Execute Sub-workflow): calls another n8n workflow
  6. Get Updated Session Values (Edit Fields (Set)): sets 1 field: data
  7. is New Session? (If): checks a condition and branches into true / false
  8. Is Waiting? (If): checks a condition and branches into true / false
  9. Update Session (Redis): set
  10. Resume Wait Node (HTTP Request): calls an HTTP API

…plus 7 more steps. See the full node list below.

Services it uses

TelegramGoogle Gemini Chat ModelRedis Chat MemoryRedis

Before you upgrade to n8n 3.0

Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.

Nodes used (14)

From the author

This n8n template demonstrates one approach to achieve a more natural and less frustration conversations with AI agents by reducing interrupts by predicting the end of user utterances. When we text or chat casually, it's not uncommon to break our sentences…

Excerpt from Jimleuk's description on n8n.io.

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.