curl --request POST \
--url https://app.thinnest.ai/api/v1/agents/{id}/channels/telegram \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"token": "7412958803:AAH3kZq9xR2mVt8LpW4nYc6bD1fS0gJe5uQ"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({token: '7412958803:AAH3kZq9xR2mVt8LpW4nYc6bD1fS0gJe5uQ'})
};
fetch('https://app.thinnest.ai/api/v1/agents/{id}/channels/telegram', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.thinnest.ai/api/v1/agents/{id}/channels/telegram"
payload = { "token": "7412958803:AAH3kZq9xR2mVt8LpW4nYc6bD1fS0gJe5uQ" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"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"
]
}
}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.
curl --request POST \
--url https://app.thinnest.ai/api/v1/agents/{id}/channels/telegram \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"token": "7412958803:AAH3kZq9xR2mVt8LpW4nYc6bD1fS0gJe5uQ"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({token: '7412958803:AAH3kZq9xR2mVt8LpW4nYc6bD1fS0gJe5uQ'})
};
fetch('https://app.thinnest.ai/api/v1/agents/{id}/channels/telegram', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.thinnest.ai/api/v1/agents/{id}/channels/telegram"
payload = { "token": "7412958803:AAH3kZq9xR2mVt8LpW4nYc6bD1fS0gJe5uQ" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"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"
]
}
}Authorizations
Your API key (ta_live_…) from Settings → API keys, sent as Authorization: Bearer <key>. Keep it on a server: it can message every customer you have. A key is full, build or read-only; a request its level does not allow is refused with 403.
Headers
Developers only: the customer workspace this request acts in — its org_… id from POST /customers. Leave it out to act in your own workspace.
"org_3fKq9TzQ1mN8vB2xR7cLpA"
Path Parameters
The agent's id (ag_…).
Body
The bot token @BotFather sent you. Stored encrypted; never returned.
Response
Connected. The agent's channels, naming the bot by its username.
Where an agent answers. A channel never set up has id: null.
The agent's id.
"ag_5c4a5f93-2b1e-4d7a-9f60-8e2d1c3b4a71"
The website chat widget.
Show child attributes
Show child attributes
The WhatsApp Business number. Connected in the console.
Show child attributes
Show child attributes
The Telegram bot.
Show child attributes
Show child attributes
Calls.
Show child attributes
Show child attributes