Skip to main content

Telegram

Using hosted SimplePost? See connection requirements. The credential setup below is for your own SDK, local CLI, or self-hosted integration.

Telegram is the simplest provider to set up. SimplePost posts through a bot token and a target chat ID. There is no OAuth flow.

Content support

Current hosted app and core source

CapabilitySimplePost support
Text / caption (characters)4,096 text; 1,024 caption
Media10 items max; Mixed media supported
Image size10 MiB maximum
Video size50 MiB maximum
  • SimplePost downloads URL media and uploads it to Telegram using multipart/form-data.

These validation limits also match published SDK 1.3.1.

Provider permissions and quotas still apply. SimplePost storage can impose a lower upload limit. MB/GB use decimal bytes; MiB/GiB use binary bytes.

Set up credentials

1. Create a bot

  1. Open Telegram and start a chat with BotFather.
  2. Send /newbot.
  3. Follow the prompts.
  4. Copy the bot token.

2. Get the chat ID

For a public channel or group, you can often use the handle:

@your_channel

For private chats or groups:

  1. Add the bot to the chat.
  2. Send a message in the chat.
  3. Call getUpdates with the bot token:
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates"
  1. Find chat.id in the response.

Environment variables

TELEGRAM_BOT_TOKEN=

The chat ID is not read from any env var. Pass it through options.telegram.chatId on every SDK call, or store it on the local CLI account / accounts.json entry as platformAccountId.

SDK options

await post({
content: { text: "Hello <b>Telegram</b>" },
platforms: ["telegram"],
options: {
telegram: {
chatId: "@mychannel",
parseMode: "HTML",
},
},
});

parseMode can be HTML, Markdown, or MarkdownV2. Note that Telegram requires aggressive escaping in MarkdownV2 (every _*[]()~\>#+-=|.!must be escaped); pickHTML` if you do not need that level of control.

Reply to an existing message:

await post({
content: { text: "Replying" },
platforms: ["telegram"],
options: {
telegram: { chatId: "@mychannel", replyTo: "12345" },
},
});

REST server account

Add this entry under accounts in the self-hosted REST server's accounts.json:

{
"id": "telegram-news",
"platform": "telegram",
"platformAccountId": "@your_channel",
"credentials": { "botToken": "123456:ABC..." },
"options": { "parseMode": "HTML" }
}