Telegram
Connect an agent to a Telegram bot so people can chat with it in private messages
Connect an agent to a Telegram bot. People open a private chat with the bot and the agent answers there. Replies stream into one live message that updates as the agent works.
You need:
- An agent in the AgentBlit console.
- A Telegram account, to create the bot with @BotFather.
Telegram is the simplest channel to set up: you only paste a bot token. AgentBlit registers the webhook with Telegram for you.
Each Telegram bot can be connected to one agent. Connecting the same bot a second time fails with This Telegram bot is already connected to an agent.
Values at a glance
| Field in AgentBlit | Where it comes from | Looks like |
|---|---|---|
| Bot token | @BotFather, after /newbot | 123456789:AAH… (digits, a colon, then about 35 characters) |
There is nothing to configure in Telegram afterwards. When you connect, AgentBlit sets the bot's webhook to:
https://console.agentblit.com/api/webhooks/channels/telegram/<channel id>It also generates a secret that Telegram sends with every update, so only Telegram can call the webhook.
A Telegram bot has one webhook. Connecting it to AgentBlit replaces any webhook or polling setup the bot already had, so don't connect a bot that another service is using.
Set up
1. Create a bot with BotFather
- In Telegram, open @BotFather and send
/newbot. - Send the bot's name. People see it at the top of the chat, for example
AgentBlit Agent. - Send the bot's username. It must end in
bot, for exampleagentblit_support_bot. - BotFather replies with the bot's link (
t.me/<username>) and its HTTP API token. Copy the token.
Keep the token private. Anyone with it can control the bot.
2. Connect the channel in AgentBlit
- Open the agent in console.agentblit.com.
- In the agent editor, open Channels and click Connect channel.
- Leave Provider on Telegram. It is the default.
- Paste the token into Bot token.
- Pick Access. See Access.
- Click Connect.
AgentBlit checks the token with Telegram and sets the webhook. The new card shows Telegram · followed by the bot's @username.
3. Message the bot
- Open
t.me/<username>from BotFather's reply, or search for the bot's username in Telegram. - Tap Start, then send a message, for example
what can you do?.
The bot shows typing…, posts ⏳ Thinking…, and edits that message into the answer.
Access
Choose Access when you connect. Change it later in the dropdown on the channel card or with the pencil button.
| Mode | What happens |
|---|---|
| Open to anyone | Anyone who finds the bot can use the agent right away. |
| Require approval | A new person's first message gets Your access request is pending approval from the agent owner. The agent does not answer until you approve them. They must send their message again after approval. |
Telegram bots are public: anyone who knows or guesses the username can message them. People act through the agent's connected accounts and tools, so use Require approval unless the agent is meant for the public.
Contacts on the channel card lists everyone who has messaged the bot, with their Telegram name and numeric user id, and their status (active, pending, blocked).
- Approve lets a pending or blocked person use the agent.
- Block stops the agent from answering that person, without telling them.
Changing the access mode applies to people who message the bot for the first time afterwards. Existing contacts keep their status.
What people see in Telegram
Live progress message
As soon as a message arrives, the bot shows typing… and posts ⏳ Thinking…, then edits that one message as the agent works. The answer streams in about every second. Finished tool calls collapse into one summary line above the answer:
✓ 3 steps · Web Search ×2, Send EmailDenied and waiting tool calls keep a line each, for example ✗ Send Email (denied) or ⏸ Send Email (waiting for approval). An answer longer than 4,096 characters continues in a new message.
Formatting
Replies are sent as plain text. Markdown from the model, such as **bold** or # headings, appears as typed.
Approvals
When the agent calls a tool that needs approval, the run pauses and the bot sends a message like:
Approval needed: <what the tool is about to do>
<detail>: <value>
Reply "approve" or "deny".- Reply
approveoryesto continue, ordenyornoto cancel. The prompt then changes to✅ Approvedor✗ Denied. - Only the person who sent the original message can decide.
- Sending anything else instead skips the approval (
Skipped: a new message arrived.) and the agent handles the new message.
Tools that ask for input through a form cannot show the form in Telegram. That request is cancelled and the tool continues without it.
What isn't supported
- Private chats only. Messages in groups and channels are ignored, even if the bot is a member.
- Text only. For photos and files, only the caption is read. Messages without text, such as stickers or voice notes, are ignored.
- Diagrams stay as Mermaid code. Telegram replies don't include rendered images.
Commands
Send these as a message in the chat with the bot.
| Command | What it does |
|---|---|
/new | Clears this conversation's history and starts fresh (Started a new conversation.). Skips a pending approval. |
/reset | Same as /new. |
/stop | Skips a pending approval in this conversation. |
/claim 12345678 | Links your Telegram account to your memory from another chat, using the 8-digit code the agent gave you there. Codes expire after 10 minutes. Needs long-term memory on for the workspace. |
To show these in Telegram's command menu, send /setcommands to @BotFather, pick the bot, and paste:
new - Start a new conversation
stop - Skip a pending approval
claim - Link your memory with a codePublished version
Telegram conversations run the agent's published version, not the draft you are editing. After you change the prompt, tools or model, click Publish before testing in Telegram.
- An agent that has never been published runs its draft.
- With a rollout percentage set, that share of conversations runs the draft.
Edit or remove a channel
Each channel card has:
- Switch — turns the channel off and on. While it is off, the bot does not answer.
- Pencil — opens Edit Telegram channel: Name, Bot token and Access. Leave the token blank to keep the current one.
- Trash — removes the channel and deletes the bot's webhook in Telegram.
To rotate the token, send /revoke to @BotFather, pick the bot, and paste the new token with the pencil button. AgentBlit registers the webhook again with the new token. The token must belong to the same bot. A token from another bot fails with That token belongs to a different Telegram bot. To switch bots, remove the channel and connect again.
Troubleshooting
| Symptom | Fix |
|---|---|
Telegram auth failed: Unauthorized | The token is wrong or was revoked. Copy it again from @BotFather, or send /token to BotFather to see it. |
Failed to set Telegram webhook: … | Telegram rejected the webhook. Try connecting again. If it keeps failing, check that the console is reachable at its public URL. |
| The bot never replies | Message it in a private chat, not a group. Check the channel is switched on. If another service set a webhook or uses polling for this bot, it may have replaced AgentBlit's webhook: remove the channel and connect again. |
The bot replies with Something went wrong. Please try again. | The run failed. Send the message again. If it keeps happening, check the console logs for [channels] run failed. |
Replies show ** and # characters | Telegram replies are plain text. Ask the agent in its prompt to answer without Markdown. |
| New tools or prompt changes don't show up | The change is still a draft. Click Publish in the agent editor. |
Your access request is pending approval from the agent owner. | Access is Require approval. Approve the person in Contacts, or switch Access to Open to anyone. |
This Telegram bot is already connected to an agent | A bot can be connected to one agent. Remove the existing Telegram channel for that bot first. |