Telegram
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
| Capability | Support |
|---|---|
| Text | Up to 4096 characters for plain messages, 1024 characters for media captions. |
| Formatting | HTML, Markdown, or MarkdownV2 parse mode. |
| Media | Images and videos. |
| Media limit | One media file per message. |
| Empty posts | Allowed when media is present. |
| Threads | Pass replyTo (a Telegram message ID as string) to make the post a reply. |
Set up credentials
1. Create a bot
- Open Telegram and start a chat with BotFather.
- Send
/newbot. - Follow the prompts.
- 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:
- Add the bot to the chat.
- Send a message in the chat.
- Call
getUpdateswith the bot token:
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getUpdates"
- Find
chat.idin 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" }
}