Skip to content

Bots in groups

A bot in a group is a different animal from a bot in a one-to-one chat. What it can see is restricted by default, the rights it holds are negotiated when it joins, and in a forum it may manage topics. This page is those three things.

Partly live

Default-administrator rights (setMyDefaultAdministratorRights) and forum-topic management are verified live — get a token with POST /newbot. Privacy mode is a bot setting configured through @GromCore, which is not up yet. Implementation status.

Privacy mode: what the bot sees

By default a bot in a group is in privacy mode and sees only the messages meant for it:

  • commands (/command),
  • @mentions of the bot,
  • replies to the bot's own messages,
  • service messages (joins, leaves, and the like).

Everything else in the group is invisible to it. This is the right default — a group bot should not be a firehose tap on every member's conversation.

Turning privacy mode off (bot_chat_history) lets the bot see all messages. Do this only for a bot that genuinely needs the full stream — a moderation or logging bot — because it changes what the group is handing over. One catch that trips everyone: toggling privacy mode does not apply to a group the bot is already in. Remove the bot and re-add it for the new setting to take effect.

The rights a bot asks for

When a bot is added to a group or channel, it can propose the set of admin rights it needs. The client shows those rights pre-checked in the add dialog, and the user can adjust them before confirming — so a bot that needs to delete spam asks for can_delete_messages up front instead of failing silently later.

The proposed set is configured with setMyDefaultAdministratorRights (separately for groups and channels — @GromCore's /setgroupadminrights and /setchanneladminrights). Ask for the minimum the bot actually uses: an over-broad request is a reason for a cautious admin to decline, and a right you hold but never use is only a liability if the token leaks.

Forum topics

In a forum — a group split into topics — a bot with the right permissions can manage them:

  • bot_forum_view — see the topic structure.
  • bot_forum_can_manage_topics — create, edit, close and reopen topics.

The topic methods (createForumTopic, editForumTopic, closeForumTopic, reopenForumTopic, deleteForumTopic) are live, so a bot granted can_manage_topics can run a forum's structure — opening a topic per incident, closing it when resolved — without a human touching the topic list. Address a message to a topic with the message_thread_id parameter on the send methods.

In short

  • A group bot sees only commands, mentions, replies and service messages — unless privacy mode is off, and toggling it needs a re-add.
  • Ask for the minimum admin rights via setMyDefaultAdministratorRights; the user sees them pre-checked.
  • With can_manage_topics, a bot runs forum topics through the live topic methods.