Prevent a Telegram bot from being added to any group or channel (allow adding it to whitelisted groups/channels)
Asked Answered
L

2

11

As far as I read the Telegram Bot API's docs, Telegram do not limit the calls to your webhook callback in any way.

I am creating a Telegram Bot that will be available only for groups and channels that I will whitelist.

I can filter out the messages I get in my webhook callback. However, a malicious user can add my bot to a thousand big groups and will possibly result in denial of service for all other users.

Even if Telegram have implemented some rate limiting such user actions may still result in denial of service for all other users.

How can I specify the groups and the channels a Telegram bot can be added to.

Lichen answered 17/9, 2018 at 14:47 Comment(0)
S
12

That feature does not exist. Either you allow all or none.

In addition to filtering, you could use leaveChat to immediately leave groups that are not on your whitelist.

And there is privacy mode which could make it harder for a malicious user.

Slain answered 17/9, 2018 at 15:49 Comment(0)
V
8

You can do it using BotFather:

/setjoingroups — toggle whether your bot can be added to groups or not. Any bot must be able to process private messages, but if your bot was not designed to work in groups, you can disable this.

https://core.telegram.org/bots

Vito answered 1/8, 2021 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.