I have a question that how to fetch the phone_number of a user by giving username or chat id. I know this question has been asked many times and everyone has said that there is no procedure for that but there is a website called Callmebot which has a form on which the user can enter the username and phone number will be shown, if the user phone number is public. Please, let me know if there is a procedure for it. I’ve to implement this procedure in a ASP.NET Core Web Application.
I’ll be very thankful for your act of kindness.
Regards,
Furrukh Nadeem
I’ve tried finding a way to solve this problem by doing literature review as well as seeing about more then 150 sites for this information and still I’m unable to find this solution.
2
Answers
The Telegram API method to retrieve a users public phone number is
users.GetUsers
which will eventually return auser
and their phone number if they are a contact or if their setting is public. Most people have their setting as private.You can see an example of how to call a method in C# here.
Fetching the Phone number given a username or user id. you can make sure of the telegram Bot API using the method getChatMember:
Use this method to get information about a member of a chat. The method is guaranteed to work for other users, only if the bot is an administrator in the chat. Returns a ChatMember object on success.
Parameter
user_id Integer Yes Unique identifier of the target user
kindly reference to the official BOT API : https://core.telegram.org/bots/api#getchatmember