Can Telegram bot detect a new member joining a channel event?
I have a Telegram bot and I set this bot as admin of a channel. I need to get the user id who joined to the channel and send me a private message with user details. is this possible?
Can Telegram bot detect a new member joining a channel event?
I have a Telegram bot and I set this bot as admin of a channel. I need to get the user id who joined to the channel and send me a private message with user details. is this possible?
2
Answers
I’m not familiar with the python implementation, but I can provide some information based on the official HTTP-based specification.
In order to listen for a member joining a channel, you would listen for
Updates
of typechat_member
. Each one will provide two values ofChatMember
, one representing the user before s/he joined the chat and one for afterwards.At this point, the API is not clearly worded, unfortunately, but you can simply do some tests. I assume that if the member object for ‘before’ has
status = "left"
, then this user just joined the chat.Yes, you can!
Offical link: https://core.telegram.org/bots/api#chatmemberupdated
Note: You need add bot to your channel and set it to admin!