Telegram Bot to Human Handoff Automation with n8n

This n8n workflow automates seamless Telegram bot-to-human handoffs by managing conversation states with Redis and AI agents. It reduces wait times and errors by ensuring structured customer onboarding and clear human transfer.
telegramTrigger
redis
switch
+11
Workflow Identifier: 1149
NODES in Use: telegramTrigger, redis, switch, lmChatOpenAi, memoryRedisChat, informationExtractor, agent, toolWorkflow, telegram, code, if, executeWorkflow, executeWorkflowTrigger, memoryManager
Automate Telegram handoffs with n8n and Redis

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow in n8n manages Telegram messages to switch between an AI chatbot and human agents smoothly.

It solves the problem of confusion and delay when changing from bot to human support during customer chats.

The workflow keeps track of each chat’s state using Redis and uses AI to collect customer details and handle conversations.

The result is faster replies, fewer errors, and a better customer experience.


Who should use this workflow?

Businesses who get many Telegram messages and want to mix AI and human customer support.

This helps when simple questions are answered by a bot but complex requests need a human agent.

Anyone running support with Telegram bots and wanting clear, organized handoffs should use this.


Tools and services used


How the workflow works: Inputs, processing, and output

Inputs

  • New Telegram messages from customers
  • Session data from Redis (state and chat memory)
  • OpenAI responses for AI agents

Processing steps

  • Use Telegram Trigger node to get incoming messages
  • Check Redis for conversation state (bot, human, onboarding) via Redis Get
  • Route message with a Switch node:
    • If “bot”, AI agent responds
    • If “human”, block bot, wait for human agent reply
    • If no state or onboarding, start onboarding flow
  • Onboarding agent gathers name, address, reason for contact using LangChain Information Extractor
  • Store and update session info in Redis with Redis Set
  • When data complete, create a summary and send to human agent for handoff
  • Notify user they speak to a human with Telegram sendAndWait
  • Wait for human reply, then save updated state back to bot with Redis
  • Keep human comments in AI memory to improve future bot responses
  • Allow user to switch back to human with a tool subworkflow
  • Send clear messages when switching or blocking input during handoff

Outputs

  • Smooth conversation transition between AI bot and human agent
  • Structured customer info collected automatically
  • User notifications for clarity on handoffs
  • Enriched AI agent memory for better follow-up replies

Beginner step-by-step: Using this workflow in n8n for production

Import the workflow

  1. Download the workflow file using the Download button on this page.
  2. Open your n8n editor where you want to add this.
  3. Click on “Import from File” and select the downloaded workflow.

Configure credentials and settings

  1. Set up your Telegram Bot API credential in the Telegram Trigger and Telegram nodes.
  2. Connect to your Redis server using the proper credentials in Redis nodes.
  3. Add your OpenAI API Key in LangChain agent nodes.
  4. If needed, update chat ID keys or Telegram channel IDs to match your environment.

Test and activate

  1. Run a test by sending a Telegram message to your bot and see if the workflow triggers.
  2. Check if onboarding collects customer data, and human handoff messages send correctly.
  3. Fix any errors or missing keys before going live.
  4. Activate the workflow to run continuously in production.

For self hosting n8n, consider this resource to run the editor and Redis yourself: self-host n8n.


Customizations

  • Add more customer fields like phone or email by updating the Information Extractor schema.
  • Swap Telegram nodes for Slack or WhatsApp if preferred.
  • Change timeout periods for human agent replies in Telegram sendAndWait nodes.
  • Connect to a CRM by adding HTTP Request or database nodes to log customer data.
  • Edit system messages in Agent nodes to match your company tone and style.

Handling errors and edge cases

  • If Redis Get returns no data, check the key pattern matches handoff_{{chatId}}_state exactly and Redis server is connected.
  • If human replies do not arrive, verify Telegram webhook URLs and that agents monitor messages properly.
  • If AI keeps asking for same info, improve prompt templates in Information Extractor and make sure Redis chat history is clean.
  • Be ready to add alerts or fallback processes if human response times are slow.

Summary of results

✓ Saves time by automating handoff between bot and humans.

✓ Collects customer info automatically during onboarding.

✓ Keeps full context of conversation for better replies.

✓ Sends clear messages so users know when help switches from bot to person.

→ Improves customer support speed and accuracy.


Automate Telegram handoffs with n8n and Redis

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The workflow defaults to onboarding mode and starts collecting customer details.
The workflow sends a session summary to the human using a Telegram sendAndWait node.
Yes, Redis stores separate session keys to manage multiple chats simultaneously.
The workflow may time out waiting; users should check webhook settings and consider adding alerts.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.