Platforms / Telegram

Telegram API

Post to Telegram channels and groups through your bot and answer the messages people send it.

At a glance

Platform id
telegram
Connects
channel or group
Sign-in
Credentials the user enters (no OAuth app needed)
Post types
Text · Image · Video · Album (up to 10 photos and videos)

Capabilities

What Telegram supports here
PublishingYes
SchedulingYes
CommentsNo
Direct messagesYes
MentionsNo
ReviewsNo
AnalyticsPartly

Required on every post

  • Text or media, and an account connected with a chat (an inbox-only bot cannot post).

Options

Send these in platform_data.telegram on the post, or flat in a target's own platform_data (the target's keys win). See Publishing.

platform_data options for Telegram
KeyTypeWhat it does
parse_modeHTML | MarkdownV2 | MarkdownHow Telegram formats the text. Default: plain text.
disable_notificationbooleanSend silently.
protect_contentbooleanBlock forwarding and saving.
disable_link_previewbooleanNo link preview on text posts.
reply_tonumberMessage id in the same chat to reply to.
message_thread_idnumberForum topic to post in.

Limits

  • 4,096 characters per message. Albums up to 10 photos and videos.
  • By URL Telegram downloads photos up to 5 MB and videos up to 20 MB itself; larger files are uploaded (photos up to 10 MB, one video up to 50 MB).
  • Telegram allows about 1 message per second per chat and 30 per second overall; when it slows a reply down, the API returns 429 platform.telegram.rate_limit with the wait in Retry-After.

Text over the limit fails validation before anything is sent. The caps of this server are explained in Rate limits.

Good to know

  • A bot can only answer: a person must open a chat with it (/start) before it can message them. After that there is no reply window.
  • Telegram gives bots no message history, so the inbox starts with messages that arrive after you connect.
  • Connecting sets the bot's webhook, replacing any other service's webhook or getUpdates polling for that bot.
  • Replies go out as text, or one photo or document per message (photos by URL up to 5 MB, other files up to 20 MB). Buttons and reactions are not sent.
  • In groups the bot sees every message only when it is an administrator or its privacy mode is off (@BotFather → /setprivacy).
  • Bot tokens do not expire. After /revoke in @BotFather, reconnect with the new token.
  • One bot shared by different customers shares one webhook; give each customer their own bot.
  • DM events carry chat_id and message_id in their metadata.

Publish with the API

curl https://api.zaynstack.com/v1/posts \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from SocialWire",
    "media": [{ "type": "image", "source_type": "url", "source": "https://example.com/file.jpg" }],
    "targets": [{ "account_id": "<Telegram account id>" }],
    "publish_now": true
  }'

An operation Telegram cannot do answers 501 resource.not_supported. Agents can do the same through the MCP server.

Connection errors

A connection that fails comes back to your redirect_uri with status=error, error=<code> and error_description, or as the error of the connect call. All codes: Connect accounts.

Connection error codes for Telegram
CodeMeaning
platform.telegram.authThe bot token is wrong or was revoked.
account.already_linkedThe brand already holds a different account on this platform, or the account belongs to another brand while lock_accounts_to_brand is on.
billing.brands_limitNo brand_id was sent, so a new brand was needed, and the plan has no room for another brand.

Webhook events

Every platform sends the post.* and account.* events. Telegram also sends:

  • dm.received

Webhook events and their payloads

Not supported yet

  • Comments, mentions and message history.
  • Buttons and reactions in replies.

Developer setup (self-hosting)

Only the operator of this server does this, once. Users then just click Connect.

  1. Message @BotFather, send /newbot, pick a name and a username ending in "bot", and copy the token it sends.
  2. To post: add the bot to the channel (as an administrator allowed to post) or group, then connect with metadata.bot_token and the chat's @username or numeric id in metadata.chat.
  3. For direct messages only: connect with the token alone.

Permissions requested

  • Bot token (no OAuth)

When a reconnect grants fewer permissions than before, an account.updated event with change permissions_reduced is sent. Accounts connected before a permission was added keep working but must reconnect to use the features it unlocks.

Before anyone can connect (review)

  1. None: no developer account, verification or app review.

Typical wait: None. Until then the app works for your own accounts and the testers you add in the console.

Other platforms

Free to start

Your next post can go everywhere at once.

No card. Connect a profile, send a post, see it land.