Skip to content

Instantly share code, notes, and snippets.

Last active November 27, 2023 17:05
  • Star 82 You must be signed in to star a gist
  • Fork 12 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Get the Telegram channel ID

To get the channel id

  1. Create your bot with botfather
  2. Make you bot an admin of your channel

New improved next steps

  1. Go to
  2. Click on your channel
  3. Look at the URL and find the part that looks like c12112121212_17878787878787878
  4. Remove the underscore and after c12112121212
  5. Remove the prefixed letter 12112121212
  6. Prefix with a -100 so -10012112121212
  7. That's your channel id.

Old yucky next steps

  1. Make your channel public
  2. Create a public link
  3. Send a message from console to @[your_public_link_text]
  4. Copy chat id from response in console as the channel id
Copy link

much easier way .. forward a message from that channel to this @JsonDumpBot bot
can voila there's your ID

ty man!

Copy link

rfwn commented Nov 8, 2021

what if i had a channel id and wanted to get the channel link?

Copy link

I still stand by my original solution above where you just have to remove a -100 from a number in a URL.

It feels a bit over-engineered to use a chatbot 🤷

Copy link

lol and there are three JsonDumpBots. The one that seems to work is the one with the dumptruck icon. But I wouldn't forward them anything sensitive :D :D :D :D :D

Copy link

ayy-em commented Jan 15, 2022

just wanted to say @syntaxhacker is da MVP for that bot link

Copy link

Just right click on channel post and select Copy Post Link, you will get something looks like to this

Then do -100 + 123456789 = -100123456789 is your Channel id.


Copy link

the solution doesn't work now. How can I find chat_id now?

Copy link

wonbinbk commented Feb 2, 2023

Thanks everyone, from this thread, I found 2 ways that work:

  1. Using, and click on the channel, the URL will be something like:, the channel id is -1001782626220
  2. Forward a message from that channel to @username_to_id_bot, it will reply with the channel id.

Copy link

lifeeric commented Feb 15, 2023

from telethon.sync import TelegramClient, events
client = TelegramClient("bot", API_ID, API_HASH)

channel_name = "channel username"
channel = client.get_entity(channel_name)
print(f'👉 Channel ID: {}')


Copy link

Well I’ve channel id but how can I find it’s channel joining link to join

Copy link

Remember to make your bot admin in your channel, otherwise none of this shit above will work

Copy link

ArgX11 commented Sep 30, 2023

How to send a DM to someone using Telegram Chat ID?
If someone's Username is John then the chat URL will be
So, if someone's Chat ID is 12345 then what will be the Telegram chat URL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment