• Stars
    star
    195
  • Rank 199,374 (Top 4 %)
  • Language
  • License
    GNU General Publi...
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

How to get an id on Telegram Messenger

How to get an id to use on Telegram Messenger

The ultimate guide

Attention

This guide aims on bot developers. If you don't develop Telegram Chatbots or don't use Telegram CLI, this guide is not for you. Don't expect to get phone numbers or to join groups by their id. Both are impossible.

Telegram Web

Available on https://web.telegram.org/?legacy=1#/login (have to use the legacy Telegram web client)

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:

https://web.telegram.org/#/im?p=g331054

If this is the case, then the group ID is -331054. Always negative!

For private super groups the url must be like:

https://web.telegram.org/#/im?p=s1041843721_16434430556517118330

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 -1001041843721.

Web Channel ID

Click on the channel you want and see the url displayed on your browser.

If it's a public channel, the ID is @name of the channel.

If it's a private channel then the url must be similar to:

https://web.telegram.org/#/im?p=c1018013852_555990343349619165

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 -1001018013852.

Telegram-CLI

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.

Run Telegram CLI:

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

Then, on Telegram CLI, type:

user_info Gabriel_R_F

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 9083329.

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

Then, on Telegram CLI, type

chat_info test

Where 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 -148228539.

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 administrator.

On Telegram CLI type:

channel_info test

where 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.

Telegram App

You can use the app directly to generate a direct link to the message and it will contain the group/channel information.

App User ID

It is not possible to get user ID from the app itself. Have to get it from a bot or CLI

App Group ID

Tap/click on the group you want and hold/right click on a message. Copy the message link.

If it's a public group, you can simply use it's @name as an id.

If it's private group, it is not possible to get a link. Have to use CLI or Web method

For private super groups the link must be like:

https://t.me/c/1041843721/200

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 -1001041843721.

App Channel ID

Tap/click on the channel you want and hold/right click on a message. Copy the message link.

If it's a public channel, the ID is @name of the group.

If it's a private channel then the url must be similar to:

https://t.me/c/1018013852/193

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 -1001018013852.

Questions?

Talk to me on Telegram Messenger! @GabrielRF

More Repositories

1

RastreioBot

Telegram Bot @RastreioBot
Python
364
star
2

Send2KindleBot

Send to Kindle Telegram Bot
Python
165
star
3

Zabbix-Telegram-Notification

Zabbix notifications on Telegram
70
star
4

Video2Telegram

Watches a folder. If new file, sends gif using Telegram Messenger.
Python
30
star
5

Rss2Telegram

Automatically sends rss feed posts to Telegram
Python
20
star
6

Telegram-Safe-Bot

Telegram Bot @Safe_Bot
Python
15
star
7

ClientesChat

A melhor maneira de atender seus clientes no Telegram!
Python
14
star
8

Docker-MongoDB-RPi

MongoDB Docker image for RaspberryPi
13
star
9

telegram-urlprobot

Telegram Bot http://telegram.me/urlprobot
Python
13
star
10

CentralDeTudo

Telegram @CentralDeTudo Bot
Python
10
star
11

telegram-lmgtfy_bot

Python
7
star
12

VideoCaptionsBot

Telegram Bot @VideoCaptionsBot
Python
7
star
13

ControlID2Telegram

Sends a text message everytime a door opens
Python
6
star
14

PromoApps

PromoApps Telegram Channel
Python
6
star
15

Voice2Text

Descrição automática de mensagens de voz em conversas privadas no Telegram
Python
6
star
16

Shell-Zabbix-WebScenario

Shell script that adds a Web Scenario and a Trigger on Zabbix
Shell
6
star
17

Weather2Telegram

Envio automático de previsão do tempo do INPE pelo Telegram
Python
5
star
18

Alohomora

Opens ControlID IDFlex when sees movement
Python
4
star
19

AcademiaNetflixBot

Python
4
star
20

ChatGPT-Telegram-Bot

Python
4
star
21

RegrasRobot

Bot do Telegram para aprovação de entrada de pessoas em grupo após leitura de regras
Python
4
star
22

Estatisticas-RastreioBot

3
star
23

PromoPassagens

Promoções de passagens aéreas no Telegram
Python
3
star
24

QuestoesDeConcursoBot

Telegram Bot QuestoesDeConcursoBot
Python
3
star
25

Document2Telegram

Watches a folder. If new file, sends it using Telegram Messenger.
Python
2
star
26

BsbDF

Telegram Public Channel
Python
2
star
27

S3Backup

Amazon S3 Backup
Python
2
star
28

Metro-Jornal-Telegram

Python
2
star
29

Obra-Regular

CSS
1
star
30

Calendar-Telegram-Alert

Python
1
star
31

ChatDeVozBot

Python
1
star
32

MQTT2Zabbix

MQTT to Zabbix
Python
1
star
33

TrafficStatus2Telegram

Python
1
star
34

ThreadLinkBot

Python
1
star