Reputation: 161
I'm using @username_to_id_bot
to retrieve the user_id
.
Sometimes the user doesn't have a username.
How can I retrive in this case?
Upvotes: 1
Views: 14255
Reputation: 6355
If you are using web application, in address bar you can see URL like following:
https://web.telegram.org/#/im?p=u1111111111_2222222222222222222
In this case 1111111111
is the user_id
which you are looking for.
Upvotes: -1
Reputation: 13973
For each user response the Telegram payload includes information like user_id and chat_id.
You can always access these navigating the JSON.
When processing a simple text response
update.message.from_user.id
When processing a Callback Query
update.callback_query.from_user.id
Upvotes: 4