Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i detect my bot's groups with Telegram bot api

Can i detect if my bot was added to group or get list groups where my bot included? Is it possible? My version is forward message from group to my bot and get chat id from message, but I think it's not best solution

like image 724
pembrock Avatar asked Oct 26 '25 21:10

pembrock


1 Answers

Bot get's Update with new_chat_members (Array of User)

As Telegram Bot API said new_chat_members is:

New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)

If you've got Update with your bot inside new_chat_members, just fetch chat_Id from Update

like image 181
Andrey Sherman Avatar answered Oct 29 '25 18:10

Andrey Sherman