n8n

How to Automate Telegram Support Handoff?

Guide Telegram chats through a clear path from onboarding to human handoff and then after sales follow up. It collects customer details in free text, switches to a human when needed, and returns context back to the bot for faster answers. Built for teams that want control and a safe human fallback.

Incoming messages from Telegram are checked in Redis to find the current state. A Switch routes each chat to one of three stages. The Onboarding Agent, powered by OpenAI and Redis memory, welcomes the user and gathers key details. An Information Extractor reads recent messages and pulls first name, last name, email, phone, and address without rigid forms. A Code and If check make sure nothing is missing. When ready, a subworkflow triggers a Telegram send and wait step to alert a human. The state changes to human and a canned reply protects the agent. When the human replies with a summary, memory updates, the state flips to bot, and the After Sales Agent continues. The agent can also call a Handoff Tool to transfer back to a person on request.

You need a Telegram bot token, an OpenAI API key, and a Redis instance. Add your human chat id, confirm Redis keys, then activate the workflow. Expect faster lead qualification, fewer data entry errors, and quicker follow ups. Useful for sales intake, support triage, and small teams that need human review on complex chats.

What are the key features?

  • Telegram Trigger listens for new messages and starts the conversation flow
  • Redis keys store and read session state per chat to control bot or human mode
  • Switch Interaction routes messages to onboarding, human handoff, or after sales
  • Onboarding Agent uses OpenAI with Redis memory to welcome and guide users
  • Information Extractor pulls name, email, phone, and address from recent messages
  • Code and If checks confirm all required fields before moving forward
  • Handoff Subworkflow sends a Telegram send and wait message to a human agent
  • Canned response blocks bot replies while a human is in control
  • After Sales Agent continues with context and can call a Handoff Tool when needed
  • Update Agent Memory writes the human summary back to the bot memory for future replies

What are the benefits?

  • Reduce manual triage time from 10 minutes to 1 minute by routing chats based on state
  • Automate up to 70% of intake questions using guided prompts and extraction
  • Improve data capture accuracy by 30% with structured information extraction
  • Handle 3 times more concurrent chats with clear bot and human states
  • Connect Telegram, OpenAI and Redis in one reliable flow
  • Shorten handoff time by notifying a human in real time and resuming with context

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Telegram, OpenAI and Redis. See the Tools Required section above for links to create accounts with these services.
  3. Create a Telegram Bot with BotFather and copy the bot token. In the n8n credentials manager, open any Telegram node, choose 'Create new credential', paste the token, and save. Test by sending a message to your bot.
  4. Find your human chat id: run the workflow once, send a message to your bot, then open the Telegram Trigger execution and copy message.chat.id from the data. Paste this value into the Human Handoff using Send and Wait node chatId field.
  5. Set up OpenAI: in your OpenAI account, create an API key. In n8n, open the OpenAI Chat Model nodes, choose 'Create new credential', paste the API key, name the credential clearly, and save.
  6. Connect Redis: in n8n credentials, create a Redis credential with your host, port, and password. Select it in all Redis nodes that get or set state or memory. Use clear names so each credential is easy to find later.
  7. Verify state keys: the workflow uses keys like handoff_{chat_id}_state and handoff_{chat_id}_chat. Confirm these patterns match your Redis settings and do not clash with other apps.
  8. Check Information Extractor attributes: confirm firstname, lastname, email, phone, and address fields match your needs. Adjust prompts if your business needs extra fields.
  9. Review the Switch Interaction rules to ensure the Human, Onboarding, and After Sales paths match your service policy. Update canned messages if needed.
  10. Enable the workflow and start a Telegram chat. Confirm onboarding prompts appear, then provide details. After completion, look for the transfer message and check the human inbox for the send and wait card.
  11. Reply as the human with a short summary. Confirm Redis changes the state to bot and the After Sales Agent responds with context. Ask for a transfer again to test the Handoff Tool path.
  12. Troubleshoot: if nothing replies, recheck Telegram credentials. If stuck in human state, open Redis and inspect handoff_{chat_id}_state. If fields are missing, widen the Information Extractor window or adjust required attributes.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Redis

Sign up

Free plan: $0 / mo, 30 MB, single DB

Telegram

Sign up

Free: $0, Telegram Bot API usage is free for developers

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.