Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I mention Telegram users without a username?

I want mention users even those which do not have a username.

If a user has set up a username I return

Hi @username 

as an answer but if a user does not have one I can't do that.

I tried using the unique User ID e.g.

@5642166

but that did not work.

How can I achieve that?

like image 539
john Avatar asked Dec 01 '16 08:12

john


People also ask

How can I get someone else's Telegram ID?

So, the easiest way to do it is talking to [@userinfobot](https://telegram.me/userinfobot). If you need to find somebody else's ID, forward a message to the bot. Click on the group you want and see the url displayed on your browser. If it's a __public__ group, you can simply use it's `@name` as an id.

How can I send a message to someone with my Telegram bot using their username?

Getting StartedOpen the telegram app and search for @BotFather. Click on the start button or send “/start”. Then send “/newbot” message to set up a name and a username. After setting name and username BotFather will give you an API token which is your bot token.

What is a Telegram username?

On Telegram, you've got your Telegram ID, and then you've got your Telegram user ID. The former is the name that you chose. To change your Telegram ID, go to the hamburger menu (three horizontal lines) and then go to Settings. The same goes on your mobile app, go to the hamburger menu, then go to Settings.


1 Answers

According to official documentation it is possible to mention user by its numerical id with markup:

Markdown style

To use this mode, pass Markdown in the parse_mode field when using sendMessage. Use the following syntax in your message:

[inline mention of a user](tg://user?id=123456789)

and you can also use HTML style :

HTML style

To use this mode, pass HTML in the parse_mode field when using sendMessage. The following tags are currently supported:

<a href="tg://user?id=123456789">inline mention of a user</a>
like image 172
GameO7er Avatar answered Sep 23 '22 01:09

GameO7er