TSocial TSocial
Open in Telegram
Better in TelegramOpen in Telegram

Add a Bot as Channel Admin and Post to Your Channel

· 4 min read · 18+ readers

Add a Bot as Channel Admin and Post to Your Channel: TSocial guide cover card

A bot icon bot can publish to a channel for you: scheduled posts, content from a feed, announcements from a website. To do that it must be an administrator with permission to post. This guide shows how to add the bot, find the channel id, send icon (paper plane) send a post and fix the usual errors. Check the Bot API reference for current method parameters.

Step 1: Add the bot as an admin

  1. Open your channel megaphone icon channel and tap its name.
  2. Tap Administrators, then Add Administrator.
  3. Search for your bot by username and select it.
  4. Turn on the rights it needs. For posting, enable Post Messages. Add Edit Messages and Delete Messages only if the bot will edit or remove posts.
  5. Save.

You can also use a link icon link: https://t.me/yourbot?startchannel&admin=post_messages. It opens a screen that lets the user choose a channel and approve the rights. See deep links.

Only channel owners and admins with the right to add admins can do this. A bot cannot add itself.

Mock Telegram channel administrator rights screen with Post Messages, Edit Messages and Delete Messages switches
Adding a bot as channel administrator and choosing its rights. Generic illustration, not a real chat or user data.

Step 2: Choose the chat id

For a public channel use the username, with the at sign:

{ "chat_id": "@mychannel", "text": "Hello channel" }

For a private channel use the numeric id, which starts with -100. To find it:

  1. Add the bot as an admin.
  2. Post any message in the channel.
  3. If your bot gets updates, look at the channel_post update and read chat.id.

You can also call getChat with a username to get the id of a public channel. See getting a username.

Step 3: Send a post

curl -X POST "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" \
  -H "content-type: application/json" \
  -d '{"chat_id":"@mychannel","text":"<b>New guide</b>\nRead it here: https://example.com","parse_mode":"HTML","disable_notification":true}'

Useful options:

  • disable_notification: sends silently. See how often to post.
  • protect_content: stops forwarding and saving of that message.
  • link_preview_options: control link previews.
  • reply_markup: inline buttons under the post. In a channel these can be URL buttons.

Photos, videos, albums (sendMediaGroup) and polls (sendPoll) work the same way. For paid posts see paid media.

Editing and deleting

Use editMessageText, editMessageCaption or deleteMessage with the chat_id and message_id returned when you posted. Store the id.

Scheduling

The Bot code icon API does not offer a scheduling parameter for normal channel posts. Do it on your side: keep a table of posts with a publish time, run a job every minute and send what is due. Make it idempotent so a retry does not double post. Humans can also use Telegram's own scheduled messages inside the app.

Reading channel posts

If the bot is an admin it receives channel_post updates for new posts in the channel, including posts made by humans. Use that to log or cross-post. Include channel_post in allowed_updates if you filter.

Comments

If the channel has a linked discussion group, comments live in that group. Add the bot to the group, not the channel, to moderate them. See comments and discussion groups.

Common errors

ErrorCause and fix
chat not foundWrong id or username, or the bot is not in the chat
Forbidden: bot is not a member of the channel chatAdd the bot as admin
not enough rights to send text messages to the chatEnable Post Messages
can't parse entitiesEscape HTML or MarkdownV2 properly
message is too longKeep text under 4096 characters

See common errors and fixes.

Safety

  • Give the bot only the rights it needs.
  • Keep the token safety icon safe. Anyone with it can post as your channel. See keeping your token safe.
  • Do not let untrusted input flow straight into posts.
  • Keep an admin account that can remove the bot quickly.

Quick checklist

  • The bot is an admin with Post Messages enabled.
  • chat_id uses @username or the -100 numeric id.
  • Posts use HTML formatting that is properly escaped.
  • disable_notification is used for lower priority posts.
  • Message ids are stored so posts can be edited or removed.
  • Scheduling is done on your side with a queue.
  • The token is stored securely.
  • A human admin can remove the bot at any time.

Editorial control

Automated posting is useful, but keep a person in charge of what goes out. Review feeds before they publish, add a pause switch and keep a log of every post. A bot that publishes the wrong thing to a large audience is hard to take back.

Frequently asked questions

Can a bot post as a person?

It posts as the channel or as the bot name, depending on settings. It does not post as you.

Can a bot add subscribers?

No. People must join themselves.

How many posts can I send?

Telegram applies rate limits. See rate limits and flood control.

Does the bot see subscribers?

Not the list. Telegram gives bots limited information about members.

Related guides

More in Build on Telegram

All topics: Build on Telegram · Guide index · Explore Telegram · About TSocial

Add a Bot as Channel Admin and Post to Your Channel | TSocial