I want to know what are the ways to get the chat id of phone numbers in telegram bot programming. I have a small project that I need to get Chatid of a group of phone numbers in telegram very fast .

- 63
- 1
- 11
-
Sorry, can't understand. Do you need get phone numbers of peoples of group? or chat id of group? Or group's chat id by user's phone ? – Danil Pyatnitsev Jan 23 '19 at 10:06
-
I have a list that contain 100 phone numbers,now I need get their chat id in telegram very fast but I don't know what should I do @danil-pyatnitsev – Mohsen Naderzadeh Jan 23 '19 at 15:35
2 Answers
Sorry, you can't. Telegram bot API work in next scenario: User interact with Bot first and bot may ask for a message or for phone or for location. There is no way to send phone number and get chatId. You can ask user for a phone and in the response, you will give chat ID and Phone number of user if user will send phone number to the bot.
After it, you can campare revieved User's phone number with your database of phone number and append it with chatId.
Hope it help you.

- 2,172
- 2
- 26
- 39
Telegram's API for now only allows bots interact with people using their ChatId.
Short Answer: There is no way provided by the API to achieve what you want.
Long Answer: You can manually add this number to your contact list and then send them a message with the link to your bot (for sure you need to send them something promising or else they will not open your bot). Once they click /start
creating a function that stores the chat_id
+ firstname
in a db so you can easily retrieve later then your bot can ask for the contact of the user so you can know which chat_id belongs to a particular phone number (if the user shares it with you then fine else at least you have the chat id which is important).

- 1,852
- 18
- 29