An AI agent is a bot that lets you work with AI models through a familiar interface — in this case, Telegram. Even the simplest agent can:
- take text messages and voice recordings,
- transcribe voice,
- edit text (as a proofreader or a stylist),
- generate replies “the way an AI would”.
Agents like this free up time spent on routine work and give you a feel for how such systems operate.
What you need to get started
- A Telegram bot (created via @BotFather).
- An OpenAI account and an API key.
- The n8n platform, a visual automation builder.
- Well-written prompts (instructions for the agent).
- A bit of patience and a willingness to experiment.
Step-by-step guide
Step 1. Create a Telegram bot
Open @BotFather, send the /newbot command, and pick a name and a username: it must end in “bot”, for example my_helper_bot or MyHelperBot. Copy the token you are given: you will need it later.
Step 2. Get an OpenAI API key
Go to the OpenAI platform, open the API Keys section and create a new key. Save it (it is shown only once). Top up your balance in the Billing section, at least $5: the API works on prepaid credit, and with nothing on the account your requests will fail.
Step 3. Sign up for n8n
Sign up for the cloud version of n8n (there is a free trial). Then create a new workflow for your agent to run in.
Step 4. Set up the trigger
Add a “Telegram Trigger” node with the On message event to the workflow and connect it to your bot with the token. Check that messages from Telegram reach this node.
Step 5. Split incoming messages (text vs voice)
Use a Switch node:
- If the message is text, send it on to text processing.
- If the message is voice, send it to transcription first (turning speech into text).
Step 6. Process text messages
Add a node that extracts the text itself and passes it on (for example, with Edit Fields), so the agent can work with it further down the line.
Step 7. Transcribe voice
For voice messages:
- Use the “Telegram Get a File” node to fetch the audio file (by its file_id).
- Then the “OpenAI Transcribe a Recording” node to turn the audio into text.
Step 8. Create the “main agent”
This is the core of the system. Its job is to analyse incoming requests and route them to sub-agents (for example, to text editing or to idea generation).
In the agent’s configuration, set a system prompt: an instruction on how it hands out tasks.
Connect an OpenAI model (for example, one from the GPT family) or a similar one to this agent.
Add a memory mechanism (for example, keep the last 5–10 messages for context).
Set up a final node that sends the reply back to Telegram.
Step 9. Set up the sub-agents
Create “sub-agents”, narrowly focused modules:
- textEditor handles text editing (at different levels: proofreading, stylistic editing, deep rewrite).
- universal agent handles everything else: generating ideas, answering questions, translations and so on.
The easiest way to build a sub-agent is as an AI Agent Tool node right inside the main workflow: it gets its own system prompt and its own model. If the logic is large, move the sub-agent into a separate workflow that starts with the When Executed by Another Workflow trigger, with its own system prompt and processing nodes. That sub-workflow has to be published too: the main agent only works with the published version.
Step 10. Test and launch
Run a test in n8n and send the bot a message (for example: “Edit the text at level 3”). Check how the request travels through the chain of nodes. Fix the errors (most often they are in the prompts). When everything is ready, publish the workflow with the Publish button in the top right corner, and from then on the agent runs continuously. A normal save only stores a draft and leaves the live version unchanged. If an older guide mentions an Active toggle, n8n 2.0 (December 2025) replaced it with this very Publish button.
💙 In a few hours you can put together a working Telegram assistant without any programming. It will handle text and voice, help with rewrites and generate content.
This is the simplest route. If you want an agent with memory, files and its own server, take a look at Hermes Agent.




