Automation library · Chat assistants

Build a Telegram AI chatbot with Trilox and OpenAI

Started by an incoming Telegram message, and works across Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 29 steps, 5 branches: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAIRetrieval

29 stepsLarge: read it before trusting it with anything live
5Branches: places the flow splits
0Loops or waits
1Service it connects to

The flow

Starts it 2Model 5Logic 12Service 10

The steps in the order they run, from what starts it.

  1. 1OpenAI Chat ModelLm Chat Open AiModel
  2. 2Conversation MemoryMemory Buffer WindowModel
  3. 3Structured Output ParserOutput Parser StructuredModel
  4. 4Telegram TriggerTelegram triggerStarts it
  5. 5Trilox Trigger (Agent Reply)Trilox triggerStarts it
  6. 6AI AgentAgentModel
  7. 7Message Type RouterSwitchLogic
  8. 8Channel RouterSwitchLogic
  9. 9Check Handler (Post-Bot)TriloxService
  10. 10Extract TextSetLogic
  11. 11Download Voice FileTelegramService
  12. 12Ignore UnsupportedNo OpLogic
  13. 13Forward to TelegramTelegramService
  14. 14Other Channels (Placeholder)No OpLogic
  15. 15Handler Status Router 2SwitchLogic
  16. 16Merge Text InputMergeLogic
  17. 17Transcribe Voice MessageOpen AiModel
  18. 18Send Bot ReplyTelegramService
  19. 19Suppress Bot ReplyNo OpLogic
  20. 20Record Visitor MessageTriloxService
  21. 21Record Bot ResponseTriloxService
  22. 22Check Handler (Pre-Bot)TriloxService
  23. 23Needs Human?IfLogic
  24. 24Handler Status RouterSwitchLogic
  25. 25Escalate to HumanTriloxService
  26. 26Done (No Escalation)No OpLogic
  27. 27Send Awaiting MessageTelegramService
  28. 28Bot Stays SilentNo OpLogic
  29. 29Record Awaiting MessageTriloxService

How it's built

Starts on
An incoming Telegram message
Steps
29, with 5 branches
Size
Large: read it before trusting it with anything live
Connects to
Telegram
Model
OpenAI
Retrieval
Answers are drawn from documents you supply, not from the model alone

Questions

What does it need to run?

An n8n account, plus your own Telegram account, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming Telegram message.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 29 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 29 steps before you point it at anything that matters.