Growing
How to use a bot to post to a Telegram channel
By the Botable team
A bot posts to a channel by being an admin of it with the post-messages right. Add it as an administrator, get the channel id, and send to that id. Channels are broadcast-only, so a bot cannot have a conversation there.
Watch it
Posting to a channel is the same send call with a different chat id. Getting the bot admitted as an admin with post rights is the part that takes a minute.
Read the transcript
Everything said in the video, in order.
A bot can publish to a Telegram channel. What it cannot do is sit in one as an ordinary member.
It is an administrator there or it is nothing, and one specific right decides whether it may post.
Telegram grants that, not Botable. In the channel's administrators list, add your bot and turn on Post Messages. Add Edit Messages if it will update posts.
Miss that one right and the failure is quiet — your handler runs, Telegram refuses, and the channel shows nothing. Ask Botable for the posting itself.
The send is ordinary. The same call your bot makes to a person, aimed at a channel instead. A public channel has a handle of its own, like the bot's here.
A private channel has no username, so you need its numeric id. It is negative, it begins with minus one hundred, and your bot can read it off a forwarded post.
The Broadcast screen is the closest thing on this page, and it is a different job. It reaches the fifty three people who have written to this bot.
Everyone here means everyone who messaged the bot. A channel post is your own code sending to a chat id, on your own schedule, with this page closed.
Admin rights, the right chat id, and the code does the rest. Start free at botable dot I O.
The short version
Publishing to a Telegram channel from a bot differs from a group in ways that catch people out. A bot cannot be an ordinary channel member, it is either an administrator or absent, and posting requires the post-messages right specifically. Once that is set, sending is the same call as any other chat, addressed to the channel's id, which for channels and supergroups is a negative number beginning with -100 rather than the @username people expect. Channels are broadcast surfaces: there is no conversation to respond to, so a bot there publishes and edits rather than replies. Editing is the underused capability. Because a bot can edit a message it posted, a channel post can be kept current in place, a price, a status, a leaderboard, instead of being superseded by a newer post, which is what turns a channel into something people scroll past.
Step by step
How do you give the bot access?
Open the channel, go to Administrators, add the bot, and enable Post Messages. Add Edit Messages if it will update posts and Delete Messages if it will remove them. Without post-messages the send is refused, and the refusal is silent from the channel's side.
How do you find the channel id?
For a public channel, @username works. For a private one you need the numeric id, which is negative and starts with -100. The reliable way to get it is to have the bot report the chat id of a message forwarded from the channel, see the chat-id guide for the exact method.
How do you schedule posts?
Your bot schedules them, not Telegram, store the post and its send time and have a scheduled job publish it. Store the author's timezone with the time, because a scheduled post is the place where an ambiguous hour is most visible.
When should you edit rather than post again?
Whenever the post is a live value: a price, a countdown, a status, standings. Editing keeps one authoritative message instead of a scroll of stale duplicates, and subscribers are not notified for each update, which is precisely what you want for something that changes hourly.
What catches people out
- Bots cannot be ordinary channel members, administrator or nothing
- Channel ids are negative and start with -100; a positive id is a private chat, not your channel
- Editing does not notify subscribers, which is the point for live values and a problem if you expect a ping
Questions
Can the bot read comments on a channel post?
Comments live in the linked discussion group, not the channel. Add the bot to that group with the appropriate permissions and it can read and moderate them there.
Can it post to several channels at once?
Yes, it can be an admin of many. Space the sends rather than firing them simultaneously, because bulk publishing runs into Telegram's rate limits quickly.
Want a bot that does this?
Describe it in plain language and Botable writes the code, gives the bot its own database, deploys it and keeps it running. Everything on this page is handled for you, the token, the webhook, the storage, the hosting.
Keep reading
- Finding chat and user IDstelegram chat id
- Scheduled messagestelegram bot scheduled messages
- Rate limitstelegram bot rate limits