Skip to content

Connect Telegram with your own bot

Telegram does not expose consumer OAuth for posting. Instead, every Postproxy Telegram profile represents one bot that you create yourself via @BotFather. Postproxy uses that bot’s token to publish to any channel where the bot has been added as administrator.

A single Telegram profile can publish to multiple channels — each channel is exposed as a placement and selected per-post via the chat_id parameter.

Open Telegram and start a chat with @BotFather. Send /newbot, then follow the prompts:

  1. Bot name — any human-readable name (e.g. Acme Publisher).
  2. Bot username — must end in bot (e.g. acme_publisher_bot). Must be globally unique on Telegram.

@BotFather replies with the bot’s API token, formatted like 123456789:ABCdef-GhIJklMnOpQrStUvWxYz. Copy it — you’ll paste it into Postproxy in the next step.

Use the Initialize Connection endpoint with platform: "telegram" and the token you just copied:

Terminal window
curl -X POST "https://api.postproxy.dev/api/profile_groups/YOUR_PROFILE_GROUP_ID/initialize_connection" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "telegram",
"bot_token": "123456789:ABCdef-GhIJklMnOpQrStUvWxYz"
}'

Postproxy validates the token, registers a webhook with Telegram, and returns the new profile:

{
"success": true,
"profile": {
"id": "prof321zyx",
"network": "telegram",
"name": "Acme Publisher",
"external_username": "acme_publisher_bot"
},
"next_step": "Add @acme_publisher_bot as administrator to the Telegram channel(s) you want to publish to. Channels will appear in GET /api/profiles/prof321zyx/placements once Telegram notifies us."
}

You can also connect from the Postproxy dashboard: Profiles → Connect account → Telegram, then paste the bot token.

Step 3: Add the bot as administrator to your channels

Section titled “Step 3: Add the bot as administrator to your channels”

For each Telegram channel you want to publish to:

  1. Open the channel in Telegram and tap the channel name to open its settings.
  2. Choose Administrators → Add Administrator.
  3. Search for your bot’s username (e.g. @acme_publisher_bot) and select it.
  4. Grant the Post Messages permission (and Edit/Delete Messages if you want Postproxy to be able to remove failed posts). Save.

Telegram sends Postproxy a my_chat_member event the moment your bot becomes administrator, and we record the channel as a placement on the profile.

After granting the bot admin access, list the bot’s available channels with GET /api/profiles/:id/placements:

Terminal window
curl "https://api.postproxy.dev/api/profiles/prof321zyx/placements" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"data": [
{ "id": "-1001234567890", "name": "My Channel (@mychannel)" },
{ "id": "-1009876543210", "name": "Private Channel" }
]
}

The list is empty until at least one channel grants the bot administrator rights. If you’ve just added the bot, poll this endpoint every few seconds until the expected channels appear.

Use the placement id from the previous step as chat_id when creating a post. chat_id is required for every Telegram post — there is no default placement.

Terminal window
curl -X POST "https://api.postproxy.dev/api/posts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"body": "Hello from Postproxy 👋",
"profiles": ["telegram"],
"platform_parameters": {
"telegram": {
"chat_id": "-1001234567890"
}
}
}'

See Telegram platform parameters for the full set of options (formatting, link previews, media groups).

Telegram requires bot_token in the payload (422) — the request body is missing the bot_token field. Re-issue the request with the token from @BotFather.

Telegram bot token is invalid or revoked (401) — the token is rejected by Telegram. Open @BotFather → /mybots → select your bot → API Token to view the current token, or Revoke current token to issue a new one, then submit the new token.

This Telegram bot is already connected to Postproxy (422) — the same bot is already linked to another Postproxy profile group. Either create a separate bot via @BotFather or remove the existing connection first.

Channels never appear in /placements — confirm the bot is an administrator of the channel (not just a member) and has Post Messages enabled. If it still doesn’t show up, remove the bot from the channel and re-add it as administrator — that re-fires Telegram’s my_chat_member event.

Posts fail with chat_id is required — every Telegram post needs an explicit chat_id in platform_parameters.telegram. There is no default channel.