Check Member<!-- --> | Blog | Tuhin

Check Member

📅 17th February 2021 🧔 Tuhin Kanti Pal

Check Member

In this Blog let's talk about how to check someone is channel member or not before using your bot. If someone use a bot, bot will recieve the User ID of that user. We will verify that id from your channel member's database.

Process :

Firstly, have to create a Bot from BotFather. After a successfull creation you will recieve a Bot API token.

Afterthat, make that bot an admin of your channel.

Now, Grab your channel id using this bot.

When, someone message to your bot you have to call an api (GET)

https://api.telegram.org/bot{BOY_API_KEY}/getChatMember?chat_id={CHANNEL_ID}&user_id={USER_ID}

You will recieve some status from response

If "ok" object of that response is false, that means user not in channel.


If "ok" object of that response is true there is some possibilities, you have to check "status" object in "result" of that response.

Possiblities are given below 👇
ReasonMeaning
leftUser previously joined and later leave your channel (Not in channel)
kickedHe is kicked by admin of your channel (Not in channel)
creatorCreator of channel (In channel)
administratorAdmin of channel (In channel)
memberMember of channel (In channel)