How to get an id to use on Telegram Messenger
The ultimate guide
Available on https://web.telegram.org
Follow the steps displayed to log in the app.
Web User ID
It's not possible to find the user ID using this method. So, the easiest way to do it is talking to @userinfobot. If you need to find somebody else's ID, forward a message to the bot.
This bot is not mine! Use it on your own risk!
Web Group ID
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.
If it's private group, the url must be like:
If this is the case, then the group ID is
-331054. Always negative!
For private super groups the url must be like:
If this is the case, then the group ID whois be
1041843721. But it's important to know that super group IDs are always a 13 characters negative integer, so the correct ID is
Web Channel ID
Click on the channel you want and see the url displayed on your browser.
If it's a public group, the ID is
@name of the group.
If it's a private group then the url must be similar to:
If this is the case, then the channel ID would be
1018013852. It's important to know that channel's IDs are always negative and 13 characters long! So add
-100 to it, making the correct ID
The best way I found to get ids is using Telegram-CLI.
It's available on https://github.com/vysheng/tg
Install and run it. I recommend using bot mode
-b, but it's optional.
bin/telegram-cli -k tg-server.pub -b
Wait for it do load and then paste a bot token.
The output must be similar to this:
root@prod:/usr/src/tg# bin/telegram-cli -k tg-server.pub -b change_user_group: can't find the user telegramd to switch to Telegram-cli version 1.4.0, Copyright (C) 2013-2015 Vitaly Valtman Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'. This is free software, and you are welcome to redistribute it under certain conditions; type `show_license' for details. Telegram-cli uses libtgl version 2.1.0 Telegram-cli includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/) I: config dir=[/root/.telegram-cli] [/root/.telegram-cli] created [/root/.telegram-cli/downloads] created hash:
CLI User ID
To get a user id, ask the user to send any message do the bot and observe it on
Telegram CLI window.
The message must appear similar to this:
[11:07] Gabriel R F »»» /start
Telegram CLI, type:
Note that spaces are replaced by
The output will be something like this:
User Gabriel R F @GabrielRF (#9083329): phone: (null) offline (was online recently)
There you go! The user id, on this example, is
CLI Group ID
Add the bot to the group. On
Telegram CLI, a message will be printed.
[11:12] test Gabriel R F added user test
Telegram CLI, type
test is the group's name. Note that spaces are replaced by
The output on
Telegram CLI will be similar to:
Chat test updated admin members Chat test (id 148228539) members: test invited by Gabriel R F at [2016/03/29 11:12:30] Gabriel R F invited by Gabriel R F at [2016/03/29 11:11:18] admin
So, the id for the example group is
Group ids are always a negative integer, so remember to add the
- while using it on the Telegram API.
CLI Channel ID
Finally, to get a channel id, add the bot as a channel
Telegram CLI type:
test is the channel's name. The output must be like this:
Channel test (id 1035716040): 2 participants, 2 admins, 0 kicked
Here is the trick. Every channel id is a 13 characters negative integer. So the id for this channel is
-1001035716040 and not
1035716040 as printed.
Talk to me on Telegram Messenger! @GabrielRF