Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all users of telegram group

I'm trying to obtain all users of a telegram group, I see the method getChatAdministrators, but I think the API doesn't have a method for obtaining all members.

I'm using telegram-bot-api of nodejs

like image 350
juanjo Rodriguez Avatar asked Jun 26 '18 19:06

juanjo Rodriguez


2 Answers

Telegram Bot API:

What you are trying to archive is currently not possible using the bot api. I'm not sure about the nodejs api, but the official bot api (which your implementation is likely to use) currently doesn't allow getting specific information about all members.

What you can do though, is query how many users are currently in a group, using getchatmemberscount. And if you have the user id of one of the groups members, you can get further information about that user with the getchatmember function.

Telegram API:

With the Telegram API, you can control a "regular" user about how you would control a bot. It won't be apparent to any other users that your account is automated if you decide to use this API; in fact, the official telegram apps use it as their backend. However, you will need to sign up with your phone number just like you would with a regular account.

With this API, you can query all the chats the bot is in very easily using the getChats function. Then, you can query full chat info for a specific chat (including all users and their details) using getFullChat.

like image 154
Distjubo Avatar answered Sep 17 '22 15:09

Distjubo


You can extract all the members of any given group or channel(you need to be an admin for channel) using telethon, you can use telethon for that, you can find it here :- https://github.com/LonamiWebs/Telethon

Telethon extracts all the members of an given group and saves it in a SQLite database.

like image 27
Smitk Avatar answered Sep 18 '22 15:09

Smitk