Guide

Bots in groups

Adding your bot to a group, and what changes when it is there.

Adding the bot

The bot owner adds the bot to any group they belong to with addBotToGroup. Privacy mode defaults to on; pass privacy_mode: false only if the bot needs every message (read privacy mode first).

curl
curl https://api.sprintelex.com/addBotToGroup \
  -H "Authorization: Bearer <owner-dashboard-session>" \
  -H "Content-Type: application/json" \
  -d '{"bot_id": "<bot-id>", "group_id": "<group-id>"}'

How group threads work

  • Each group gets one thread per bot per environment. The thread id is what you pass as chat_id to sendMessage.
  • Updates from groups carry chat.type: "group" and the group's title.
  • Group membership for bots is tracked separately from human members: a bot is never a "member" in the E2EE sense and can never read the human message history.
  • Users join and leave freely; your bot learns about it through my_chat_member updates.

Removing the bot

removeBotFromGroup takes the bot out of the group. Its thread history stays readable through getBotMessages and the dashboard logs.

Test-environment bots can only be added to test groups. If you are building a group feature, create a test group in the app and use the test token end to end before going live.