At a glance
Capabilities
The capability matrix for every platform is on Supported platforms.
Connect a bot
A Telegram bot connects in one request: you send its token, and SocialAPI returns the connected account.1
Create the bot
Open Telegram and message @BotFather. Send
/newbot, choose a display name, then choose a username that ends in bot.2
Copy the token
BotFather replies with a token of the form
123456789:ABCdefGhIjKlMnOpQrStUvWxYz-1234. Anyone who holds the token controls the bot, so keep it secret.3
Connect the bot
Send the token as Response (HTTP 201):
metadata.bot_token:username is the bot’s username and display_name is its name. Without brand_id in the request, SocialAPI creates a brand for the bot. SocialAPI also sends account.connected to your webhook endpoints.
A missing bot_token returns 400 validation.field_required. A token Telegram rejects returns 401 platform.telegram.auth.
One bot, one receiver
Connecting the bot points its Telegram webhook at SocialAPI and replaces any webhook the bot already had. Telegram delivers a bot’s updates to one receiver only: while the bot is connected to SocialAPI, another service cannot receive its messages by webhook or withgetUpdates.
Disconnecting the account (DELETE /v1/accounts/{account_id}) removes the webhook, so Telegram stops sending the bot’s messages to SocialAPI. The token itself stays valid until you revoke it with /revoke in @BotFather. A bot token has no expiry date. After a revoke, connect the bot again with the new token: see Reconnect an account.
Direct messages
People start a private chat with your bot, and you read and answer their messages with the same conversation endpoints as every other platform. Once a person has written to the bot, the bot can answer at any time, and the bot can never write first. Message types, attachments, size limits, and errors are on Telegram direct messages.Webhook events
A Telegram account sends these events to your webhook endpoints:
A Telegram account emits no other event. The payloads are on Webhook events.
Scopes
A Telegram bot has no OAuth scopes. The bot token gives full control of the bot, and SocialAPI uses it to receive the bot’s messages and to send replies. The account supports themessages.read and messages.write permissions, which SocialAPI alone enforces.
Related
- Telegram direct messages: receive and send messages, attachments, limits, and errors
- Direct messages: the conversation endpoints shared by every platform
- Connect accounts: brands, reconnecting, and disconnecting
- Webhook events: the full
account.connectedanddm.receivedpayloads - Supported platforms: what each platform supports