Skip to main content

Telegram AI bot-to-human handoff for sales calls

Workflow preview

Workflow preview
100%
Telegram AI bot-to-human handoff for sales calls preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n template demonstrates an approach to perform bot to human handoff using Human in the loop functionality as a switch. In this experiment, we play with the idea of states we want our agent t...

Best for

  • Lead Nurturing automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.telegram, n8n-nodes-base.redis, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.memoryredischat, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.telegramtrigger, n8n-nodes-base.switch, @n8n/n8n-nodes-langchain.informationextractor

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Jimleuk.

Original n8n.io source

1.1 Workflow description

Title
Telegram AI bot-to-human handoff for sales calls
Workflow name
Telegram AI bot-to-human handoff for sales calls

This n8n template demonstrates an approach to perform bot-to-human handoff using Human-in-the-loop functionality as a switch.

In this experiment, we play with the idea of states we want our agent to be in which controls it's interacton with the user.

  • First state - the agent is onboarding the user by collecting their details for a sales inquiry. After which, they are handed-off / transferred to a human to continue the call.
  • Second state - the agent is essentially "deactivated" as further messages to the bot will not reach it. Instead, a canned response is given to the user. The human agent must "reactivate" the bot by completing the human-in-the-loop form and give a summary of their conversation with the user.
  • Third state - the agent is "reactivated" with context of the human-to-user conversation and is set to provide after sales assistance. An tool is made available to the agent to again delegate back to the human agent when requested.

How it works

  • This template uses telegram to handle the interaction between the user and the agent.
  • Each user message is checked for a session state to ensure it is guided to the right stage of the conversation. For this, we can use Redis as a simple key-value store.
  • When no state is set, the user is directed through an onboarding step to attain their details. Once complete, the agent will "transfer" the user to a human agent - technically, all this involves is an update to the session state and a message to another chat forwarding the user's details.
  • During this "human" state, the agent cannot reply to the user and must wait until the human "transfers" the conversation back. The human can do this by replying to "human-in-the-loop" message with a summary of their conversation with the user. This session state now changes to "bot" and the context is implanted in the agent's memory so that the agent can respond to future questions.
  • At this stage of the conversation, the agent is now expected to handle and help the user with after-sales questions. The user can at anytime request transfer back to the human agent, repeating the previous steps as necessary.

How to use

  • Plan your user journey! Here is a very basic example of a sales inquiry with at most 3 states. More thought should be developed when many more states are involved.
  • You may want to better log and manage session states so no user is left in limbo. Try connecting the user and sessions to your CRM.
  • Note, the Onboarding agent and After-Sales agent have separate chat memories. When adding more agents, it is recommend to continue having separate chat memories to help focus between states.

Requirements

  • Telegram for chatbot & interface
  • Redis for session store and chat memory
  • OpenAI for AI agent

Customising this workflow

  • Not using Telegram? This template works with Whatsapp and other services with equivalent functionality.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Human Handoff using Send and Wait

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 2 - Set Interaction to Bot

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 3 - Set Interaction to Human

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 4 - Get Interaction State

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 5 - Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 6 - Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryRedisChat - memoryRedisChat
Config choices
Version 1.4

Block 7 - Handoff Subworkflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 8 - Telegram Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.1

Block 9 - Send Response

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 10 - Switch Interaction

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 11 - Information Extractor

Type / Role
@n8n/n8n-nodes-langchain.informationExtractor - informationExtractor
Config choices
Version 1

Block 12 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 13 - With Defaults

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Has All Criteria?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 15 - Onboarding Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 16 - Get Onboarding Chat History

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 17 - After Sales Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.8

Block 18 - Memory1

Type / Role
@n8n/n8n-nodes-langchain.memoryRedisChat - memoryRedisChat
Config choices
Version 1.4

Block 19 - Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 20 - Handoff Tool

Type / Role
@n8n/n8n-nodes-langchain.toolWorkflow - toolWorkflow
Config choices
Version 2

Block 21 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Handoff Subworkflow1

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Showing the first 24 of 39 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Telegram AI bot-to-human handoff for sales calls
Complexity advanced
Nodes 39
Categories Lead Nurturing, AI Chatbot
Author Jimleuk
Published 29 Mar 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3350/3350.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Telegram AI bot-to-human handoff for sales calls do?

This n8n template demonstrates an approach to perform bot to human handoff using Human in the loop functionality as a switch. In this experiment, we play with the idea of states we want our agent t...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Lead Nurturing, AI Chatbot use case.