I'm currently working on a Telegram Bot that gets user information in Telegram once you know a phone number. The main goal is to get all the user information stored in Telegram for a user, just knowing his/her phone_number.
So, I have tried using the sendContact function as explained in the Telegram Bot API and like this post: How to get user_id of a phone number in telegram
The problem is that if I try to so this sending my own number as a contact to my chat_id, I receive the Contact structure, but if I send from the bot to myself another phone_number (which corresponds to another active Telegram account), I get no user_id in the JSON file. The problem is that I can just get an user_id, if I use the phone_number of the chat_id account, that means that I can't get any information about anyone using his phone number. But I have seen a lot of possible solutions, but none is working for me.
Any help would be appreciated!
I'm using:
https://api.telegram.org/bot<BOT TOKEN>/sendContact?chat_id=<MY CHAT ID>&phone_number=<PHONE_NUMBER I WANT TO KNOW USER_ID>&first_name=<RANDOM NAME>
If use use my own chat_id to receive the message and my phone_number it works, whenever I use another phone_number it does not.