Skip to main content

Build a Telegram AI chatbot with human takeover using Trilox and GPT-4o-mini

Workflow preview

Workflow preview
100%
Build a Telegram AI chatbot with human takeover using Trilox and GPT-4o-mini preview
Open on n8n.io

1. Workflow Overview

️ This template uses the Trilox community node (n8n nodes trilox) and requires self hosted n8n. Who is this for n8n developers building Telegram cha...

Best for

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

Tools used

@n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.memorybufferwindow, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.switch, n8n-nodes-base.telegramtrigger, n8n-nodes-base.telegram, @n8n/n8n-nodes-langchain.openai

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Build a Telegram AI chatbot with human takeover using Trilox and GPT-4o-mini
Workflow name
Build a Telegram AI chatbot with human takeover using Trilox and GPT-4o-mini

> ⚠️ This template uses the Trilox community node (n8n-nodes-trilox) and requires self-hosted n8n.

Who is this for

n8n developers building Telegram chatbots who need to take over from the bot when it fails — without the customer getting double replies.

How it works

  1. Customer sends a message on Telegram (text or voice)
  2. The message is recorded to Trilox and the handler status is checked
  3. If the bot is in control → the AI Agent responds with a structured escalation flag
  4. After the AI responds, the handler is checked again — catching the race condition where a human took over while the AI was thinking
  5. If the AI decides a human is needed → the conversation is escalated and the customer is notified
  6. A human takes over from the Trilox inbox → the bot goes completely silent
  7. The human replies from Trilox → the reply is forwarded to Telegram
  8. Human hands back → bot resumes automatically

How to set up

  1. Install the Trilox community node (Settings → Community Nodes → Install n8n-nodes-trilox)
  2. Create a free account at trilox.io
  3. Create a Project → App (inbox) → API Key in Trilox
  4. Create a Telegram bot via @BotFather and get the API token
  5. Set up credentials for Trilox, Telegram, and OpenAI in n8n
  6. In all Trilox nodes, select your App from the dropdown
  7. Update the AI Agent system prompt with your business info and escalation rules
  8. Activate the workflow

Requirements

  • Self-hosted n8n (community nodes required)
  • Trilox account (trilox.io) — free plan available
  • Telegram Bot (via @BotFather)
  • OpenAI API key (or any LLM provider)

How to customize

  • Escalation rules: Edit the system prompt to define when is_human_required should be true (refunds, complaints, billing)
  • Different LLM: Replace OpenAI with OpenRouter, Anthropic, or any compatible model
  • Add channels: The Channel Router has placeholders for WhatsApp, Messenger, Instagram, Widget, and API
  • Remove voice: Delete the voice branch if you don't need it
  • Add knowledge base: Give the AI Agent tools (Google Docs, Notion, vector store)

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 - AI Agent

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

Block 2 - OpenAI Chat Model

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

Block 3 - Conversation Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 4 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.3

Block 5 - Handler Status Router

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

Block 6 - Telegram Trigger

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

Block 7 - Message Type Router

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

Block 8 - Download Voice File

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

Block 9 - Transcribe Voice Message

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

Block 10 - Merge Text Input

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

Block 11 - Extract Text

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Needs Human?

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

Block 13 - Send Bot Reply

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

Block 14 - Handler Status Router 2

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

Block 15 - Done (No Escalation)

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

Block 16 - Suppress Bot Reply

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

Block 17 - Send Awaiting Message

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

Block 18 - Bot Stays Silent

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

Block 19 - Forward to Telegram

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

Block 20 - Record Visitor Message

Type / Role
n8n-nodes-trilox.trilox - trilox
Config choices
Version 1

Block 21 - Record Bot Response

Type / Role
n8n-nodes-trilox.trilox - trilox
Config choices
Version 1

Block 22 - Record Awaiting Message

Type / Role
n8n-nodes-trilox.trilox - trilox
Config choices
Version 1

Block 23 - Check Handler (Pre-Bot)

Type / Role
n8n-nodes-trilox.trilox - trilox
Config choices
Version 1

Block 24 - Check Handler (Post-Bot)

Type / Role
n8n-nodes-trilox.trilox - trilox
Config choices
Version 1

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

3. Summary Table

Workflow Build a Telegram AI chatbot with human takeover using Trilox and GPT-4o-mini
Complexity advanced
Nodes 37
Categories Support Chatbot, AI Chatbot
Author Trilox
Published 14 Feb 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13394/13394.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 Build a Telegram AI chatbot with human takeover using Trilox and GPT-4o-mini do?

️ This template uses the Trilox community node (n8n nodes trilox) and requires self hosted n8n. Who is this for n8n developers building Telegram cha...

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 Support Chatbot, AI Chatbot use case.