Skip to content

Instantly share code, notes, and snippets.

@steffiland
Last active October 3, 2019 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steffiland/7797fb7578620ea81927ee66b25c8a89 to your computer and use it in GitHub Desktop.
Save steffiland/7797fb7578620ea81927ee66b25c8a89 to your computer and use it in GitHub Desktop.

How to detect Telegram Chat IDs

... by opening https://web.telegram.org/ in a Browser:

for a user

group

Open the group's chat window and inspect the URL: https://web.telegram.org/#/im?p=g[GROUP_ID] ⇒ the chat ID will be -[GROUP_ID] (prepend a minus)

public channel

The chat ID is an @ sign, followed by the channel's name.

private channel or supergroup

Open the channel's chat window and inspect the URL: https://web.telegram.org/#/im?p=c[SOME_DIGITS]_[EVEN_MORE_DIGITS] ⇒ the chat ID will be -100[SOME_DIGITS] (prepend a minus and 100, leave out the underscore and following numbers. The ID is always a 13 characters negative integer).

send a message via commandline

curl -s -X POST https://api.telegram.org/bot${apiToken}/sendMessage -d chat_id=${chatId} -d text="Hello World"

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