Telegram
Xagent can connect a Telegram bot to your account so you can start and continue tasks directly from Telegram. The current integration is user-owned:- You create a channel under the Channels page in Xagent
- You provide a Telegram bot token from BotFather
- Xagent starts or reloads the bot automatically when the channel is saved and active
What this integration supports
The current Telegram channel supports:- Text conversations
- Continuing an existing conversation in the same chat
- Starting a fresh conversation with
/new - Stopping or pausing the current run with
/stopor/pause - Uploading files such as documents, images, audio, or video into the task workspace
Quick setup
1. Create a bot in BotFather
Open Telegram and chat with@BotFather.
Use /newbot, follow the prompts, and save the bot token.
The token looks like:
2. Open the Channels page in Xagent
In the Xagent web app, go to Channels and add a new Telegram Bot channel. For Telegram, the UI currently supports these fields:- Bot token: required
- Allowed users: optional, comma-separated Telegram user IDs in the UI, represented as an array of strings in the API and stored channel config
- Active: whether this bot should be running
3. Save and activate the channel
When you save the channel:- Xagent validates and stores the configuration
- Xagent attempts to resolve the bot name from Telegram
- The backend reloads the active Telegram bot set automatically
Channel configuration model
The Telegram channel is stored as a normal user channel:channel_namecan be omitted in API calls; the backend will try to fetch the bot name automaticallyallowed_usersis optionalbot_tokenis required for Telegram
Using the Telegram bot
Start chatting
After the channel is active, open your bot in Telegram and send a message. Xagent will create a task for that conversation and continue the same task on later messages unless you explicitly start over.Start fresh with /new
Use:
Stop or pause a run
Use either:Upload files
You can send files or media to the Telegram bot. Xagent downloads the attachment, registers it in the task workspace, and makes it available to the agent during execution. This currently covers common Telegram attachments such as:- documents
- photos
- audio
- video
Access control
The Telegram integration currently uses a simple allowlist model. Ifconfig.allowed_users is set, the sender’s Telegram user ID must be included. Otherwise, the bot replies with an authorization error.
Use numeric Telegram user IDs, for example:
API example
You can also create the Telegram channel via API:Security notes
- Telegram bot tokens should be treated like secrets
- Xagent stores sensitive channel secrets encrypted at rest when encryption is configured
- Restrict
allowed_usersfor private bots instead of leaving the bot open to anyone
Troubleshooting
The bot does not respond
Check:- the channel is saved with
is_active: true - the
bot_tokenis valid - the backend process is running
Save fails when creating the channel
Common causes:- missing
bot_token - duplicate bot token already configured in another channel
- duplicate channel name for the same user
A user gets an authorization error
Checkconfig.allowed_users. If it is set, the sender’s Telegram user ID must be present in that list.
The bot name is wrong or missing
Ifchannel_name is omitted, Xagent tries to fetch the name from Telegram with getMe. If that lookup fails, you may see a generic fallback name such as Telegram Bot.