At a glance
Capabilities
Connecting
Telegram does not use OAuth. There is no authorization URL, nocode exchange, no refresh token, and no token expiry. You create a bot with @BotFather, copy its token, and pass it in metadata.bot_token:
Getting a bot token
- Open Telegram and message @BotFather.
- Send
/newbotand follow the prompts (choose a name and a username ending inbot). - BotFather replies with a token of the form
<bot_id>:<secret>. - Paste that token as
metadata.bot_token.
Reading and sending DMs
Telegram has no message-history API: a bot only sees messages that arrive after it is connected. SocialAPI builds the inbox from inbound webhook events from connect time onward.List DM conversations
Send a DM
account_id is required. Omitting it returns 400 field_required.
Send a DM with an attachment
Useattachment_url to send a file. SocialAPI picks the Telegram method based on the URL extension: image extensions (.jpg, .jpeg, .png, .gif, .webp) call sendPhoto; all other extensions call sendDocument.
Limitations and gotchas
- The bot cannot start a conversation. Telegram forbids a bot from messaging a user who has never messaged it. Sending to such a user returns
telegram.cannot_message(HTTP 403). The user must send/startor any message to the bot first. There is no 24-hour window once started. - No message history backfill. There is no list or history endpoint in the Bot API. The inbox is populated only by webhooks received after you connect.
- DM-only. Posts, channels, and comments are not supported through this connector.
- No token expiry. A bot token never expires. It is revoked only via @BotFather (
/revoke). If a token is revoked, reconnect with a fresh token.
Errors
See Errors for the full catalog.