首页 » Accessing the Current User’s Own Phone Number:

Accessing the Current User’s Own Phone Number:

Rate this post

users.getFullUser / td_api.getMe (TDLib): Once authenticated, your client can use methods like users.getFullUser (MTProto) or td_api.getMe (TDLib) to retrieve the profile information of the currently logged-in user. This User object (or UserFull in some contexts) will typically include the phone! _number of the authenticated user.
>TDLib user object: The user object in TDLib (returned by getUser or other methods) has a phone_number_ field for the user’s own number.
2. Accessing Phone Numbers of Other Contacts (from the User’s Contact List):

This is where privacy settings come into play


Purpose: This method is used by custom clients to upload a list of phone numbers (e.g., from the device’s native address book) to Telegram’s servers. Telegram then identifies which of these numbers belong to existing Telegram users.
User Permission: Your custom client must obtain ! explicit permission from the user to access their device’s contacts before calling this method.
Result: The contacts. imported telegram number database Contacts response! will return Imported Contact objects, which include the user_id of the Telegram user if found. Critically! it will also return a User object for each imported contact.

Adding Contacts and Phone Number Visibility Exceptions:


>>Visibility Limitations: The phone_ number field for other users within the User object obtained through import Contacts or users. getUsers (after understanding the importance of an emergency contact number finding them by ID) will only be populated if that other user’s Telegram privacy settings allow your client’s authenticated user to see their phone number.
>If the other user’s “Who can see my phone number?” setting is “Nobody!” you generally won’t get their phone number even if they are in your contact list.


f it’s “My Contacts” and the user is in the authenticated client’s contact list, then the number should be accessible.
contacts.getContacts (MTProto / TDLib): This book your list method retrieves the current user’s entire contact list from Telegram’s cloud. The returned User objects for each contact will include their phone_number only if the contact’s privacy settings permit it.

滚动至顶部