Search code examples
telegramtelegram-bottelegram-webhook

Is Telegram username unique?


When I work over bot development, I found that messages that comes from user have some field called username, e. g.

{
    update_id: 123567890,
    message: {
        message_id: 1,
        from: {
            id: 1234567890,
            is_bot: false,
            first_name: "Kappa",
            last_name: "Pride",
            username: "kappapride",
        }
    ...
}

Does this field contains an unique value, such as id field? I know, I can make a TG link with it (like @kappapride), but I'm not sure if this field presents for each TG user.


Solution

  • Only one user can have @kappapride (I believe channels and groups can also take it) username at the same time but users can change their username at any time so no, it's definitely not fine to consider it as unique identifier for users.