Channels
Connect Telegram Bot
Connects a Telegram bot to the agent with the token @BotFather gave you: the token is checked with Telegram, stored encrypted and never shown again, and Telegram is told where to deliver messages. Telegram needs a paid plan, and a bot can belong to one agent only. Telegram calls back on the address this request arrived on, so call the public API address. A build key may do this.
POST/agents/{id}/channels/telegram
Path parameters
- idstringrequired
- The agent's id (
ag_…).
Headers
- Katexs-Workspacestring
- Developers only: the customer workspace this request acts in — its
org_…id fromPOST /customers. Leave it out to act in your own workspace. Refused with404(Workspace not found.) when the id is unknown, is not one of your customers, or is not anorg_…id;410when that customer was deleted (restore it withPOST /customers/{id}/restoreuntil it is erased);403when the key belongs to one customer workspace (it cannot act as another);400when your workspace is not a developer workspace./customers/*andGET /customers/usageare your own workspace's and refuse the header with400: call them without it.
Request body
- tokenstringrequired
- The bot token @BotFather sent you. Stored encrypted; never returned.
Example request
bash
curl -X POST "https://app.katexs.com/api/v1/agents/{id}/channels/telegram" \
-H "Authorization: Bearer $KATEXS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"token": "7412958803:AAH3kZq9xR2mVt8LpW4nYc6bD1fS0gJe5uQ"
}'Responses
| Status | Description |
|---|---|
201 | Connected. The agent's channels, naming the bot by its username. |
400 | No token, or one Telegram does not accept. |
401 | The key is missing, wrong or revoked. The answer is always the same, whichever it is. |
403 | Telegram is not on your plan, or the key is read-only (a build or full key may connect it). |
404 | No such agent in your workspace. |
409 | The bot is already connected to another agent, or Telegram cannot reach the address the request came in on. |
410 | The customer named in Katexs-Workspace was deleted. POST /customers/{id}/restore brings it back until its erase date. |
429 | Over a per-minute limit. Wait for Retry-After seconds. code and limit say which limit: rate_limit_resources (240 requests a minute for the workspace), rate_limit_family (2,400 across a developer's customers), rate_limit_calls, rate_limit_messages, rate_limit_codes, rate_limit_code_recipient, concurrent_calls or number_daily_limit. |
502 | The bot was saved but Telegram would not accept the delivery address, or the connection could not be saved. Retry. |
503 | This deployment cannot store a bot token safely. |
Response fields
- agentstringrequired
- The agent's id.
- webobjectrequired
- The website chat widget.
- whatsappobjectrequired
- The WhatsApp Business number. Connected in the console.
- telegramobjectrequired
- The Telegram bot.
- voiceobjectrequired
- Calls.
201 response
{
"agent": "ag_5c4a5f93-2b1e-4d7a-9f60-8e2d1c3b4a71",
"web": {
"id": "ch_0e6b2f71-3c9d-4a58-b1e7-5d2a8f4c9b30",
"connected": true,
"publicKey": "pk_9fQ2xLm7Rt4vWb8KcN3hYd6sJ1pZ",
"previousKeyExpiresAt": null
},
"whatsapp": {
"id": null,
"connected": false,
"phoneNumber": null,
"flagged": false,
"messagingLimit": null,
"blockingNotices": 0
},
"telegram": {
"id": "ch_5b2e9c18-4f7a-4d3e-a6b0-8c1d7e2f9a54",
"connected": true,
"username": "SkylineHomesBot",
"webhookFailed": false
},
"voice": {
"id": "ch_c3f80b2e-6d14-47a9-8e5b-1f9a2c7d4e06",
"answersCalls": true,
"phoneNumber": null,
"surfaces": [
"web",
"whatsapp"
]
}
}Last updated November 2026 · Found a problem? Email support@katexs.com
