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

⚑ 257 views Β· πŸ’¬ Support Chatbots

Description

telegramhumantakeover.jpeg > ⚠️ 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

How to customize

πŸ”— Nodes Used

Telegram, Telegram Trigger, AI Agent, OpenAI Chat Model, Simple Memory, Structured Output Parser

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup