telegramtelegram-bot

Telegram Bot: Is it possible to get userid using username?


Is it possible to get userid using username? I mean, I would like to add a feature to my bot that tells you the user id from an other user using his username.

Does Telegram API give an option to do this?


Solution

  • I believe what you mean by nickname is the username and userid is the unique id as described in the API documentation.It is still possible to do a reverse lookup using a bot.

    This is possible with a boosted version of the Official Telegram API, known as PWRTelegram API

    I quote from the documentation.

    Resolving of usernames not only with channels and groups but also with normal users and bots

    Here is a library I made for this purpose. I no longer maintain it, you can however still resolve usernames with a td-cli binary.