telegram

How can I find telegram user by id


I'm using telegram bot and can get user id from incoming message. Sometimes I want to find users who communicate with telegram bot and write them message by myself. I have only user id and have not some additional information about the user.

Can I somehow find users by id or anonimity with only id available is by design?


Solution

  • At least what I've been using...

    Program your bot to send you a message with link to that user. This can be done by using link in your message (must be used as message entity or inline keyboard button):

    tg://user?id=<user_id>
    

    Or in case you are using MarkdownV2 for formatting

    [inline mention of a user](tg://user?id=<user_id>)
    

    Then, by clicking on that link, you will open a user profile, where you can message your target.

    Note, user can change his privacy settings, and disable mentions. In this case these links will not work.