Skip to content

Instantly share code, notes, and snippets.

@nafiesl
Last active November 10, 2026 12:36
Show Gist options
  • Select an option

  • Save nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a to your computer and use it in GitHub Desktop.

Select an option

Save nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a to your computer and use it in GitHub Desktop.
How to get Telegram Bot Chat ID

How to get Telegram Bot Chat ID

Content :

  1. Create a Telegram Bot and get a Bot Token
  2. Get Chat ID for a Private Chat
  3. Get Chat ID for a Channel
  4. Get Chat ID for a Group Chat
  5. Get Chat ID for a Topic in a Group Chat

Create a Telegram Bot and get a Bot Token

  1. Open Telegram application then search for @BotFather
  2. Click Start
  3. Click Menu -> /newbot or type /newbot and hit Send
  4. Follow the instruction until we get message like so
    Done! Congratulations on your new bot. You will find it at t.me/new_bot.
    You can now add a description.....
    
    Use this token to access the HTTP API:
    63xxxxxx71:AAFoxxxxn0hwA-2TVSxxxNf4c
    Keep your token secure and store it safely, it can be used by anyone to control your bot.
    
    For a description of the Bot API, see this page: https://core.telegram.org/bots/api
    
  5. So here is our bot token 63xxxxxx71:AAFoxxxxn0hwA-2TVSxxxNf4c (make sure we don't share it to anyone).

Back to top ↑

Get Chat ID for a Private Chat

  1. Search and open our new Telegram bot
  2. Click Start or send a message
  3. Open this URL in a browser https://api.telegram.org/bot{our_bot_token}/getUpdates
    • See we need to prefix our token with a word bot
    • Eg: https://api.telegram.org/bot63xxxxxx71:AAFoxxxxn0hwA-2TVSxxxNf4c/getUpdates
  4. We will see a json like so
    {
      "ok": true,
      "result": [
        {
          "update_id": 83xxxxx35,
          "message": {
            "message_id": 2643,
            "from": {...},
            "chat": {
              "id": 21xxxxx38,
              "first_name": "...",
              "last_name": "...",
              "username": "@username",
              "type": "private"
            },
            "date": 1703062972,
            "text": "/start"
          }
        }
      ]
    }
    
  5. Check the value of result.0.message.chat.id, and here is our Chat ID: 21xxxxx38
  6. Let's try to send a message: https://api.telegram.org/bot63xxxxxx71:AAFoxxxxn0hwA-2TVSxxxNf4c/sendMessage?chat_id=21xxxxx38&text=test123
  7. When we set the bot token and chat id correctly, the message test123 should be arrived on our Telegram bot chat.

Back to top ↑

Get Chat ID for a Channel

  1. Add our Telegram bot into a channel
  2. Send a message to the channel
  3. Open this URL https://api.telegram.org/bot{our_bot_token}/getUpdates
  4. We will see a json like so
    {
      "ok": true,
      "result": [
        {
          "update_id": 838xxxx36,
          "channel_post": {...},
            "chat": {
              "id": -1001xxxxxx062,
              "title": "....",
              "type": "channel"
            },
            "date": 1703065989,
            "text": "test"
          }
        }
      ]
    }
    
  5. Check the value of result.0.channel_post.chat.id, and here is our Chat ID: -1001xxxxxx062
  6. Let's try to send a message: https://api.telegram.org/bot63xxxxxx71:AAFoxxxxn0hwA-2TVSxxxNf4c/sendMessage?chat_id=-1001xxxxxx062&text=test123
  7. When we set the bot token and chat id correctly, the message test123 should be arrived on our Telegram channel.

Back to top ↑

Get Chat ID for a Group Chat

The easiest way to get a group chat ID is through a Telegram desktop application.

  1. Open Telegram in a desktop app
  2. Add our Telegram bot into a chat group
  3. Send a message to the chat group
  4. Right click on the message and click Copy Message Link
    • We will get a link like so: https://t.me/c/194xxxx987/11/13
    • The pattern: https://t.me/c/{group_chat_id}/{group_topic_id}/{message_id}
    • So here is our Chat ID: 194xxxx987
  5. To use the group chat ID in the API, we need to prefix it with the number -100, like so: -100194xxxx987
  6. Now let's try to send a message: https://api.telegram.org/bot63xxxxxx71:AAFoxxxxn0hwA-2TVSxxxNf4c/sendMessage?chat_id=-100194xxxx987&text=test123
  7. When we set the bot token and chat id correctly, the message test123 should be arrived on our group chat.

Back to top ↑

Get Chat ID for a Topic in a Group Chat

In order to send a message to a specific topic on Telegram group, we need to get the topic ID.

  1. Similar to steps above, after we click the Copy Message Link, we will get a link like: https://t.me/c/194xxxx987/11/13, so the group Topic ID is 11.
  2. Now we can use it like so (see message_thread_id): https://api.telegram.org/bot783114779:AAEuRWDTFD2UQ7agBtFSuhJf2-NmvHN3OPc/sendMessage?chat_id=-100194xxxx987&message_thread_id=11&text=test123
  3. When we set the bot token and chat id correctly, the message test123 should be arrived inside our group chat topic.

Back to top ↑

@smarshad0607-pixel

Copy link
Copy Markdown

/start

@ccbalt

ccbalt commented Nov 7, 2025

Copy link
Copy Markdown

In telegram search for @WhatChatIDBot click on start you wil get chat ID.

works perfectly, thank you

@aflasherin33-hub

Copy link
Copy Markdown

2122110141

@anshupitlia

Copy link
Copy Markdown

I have tried getting the chatid from @whatChatIdBot and used for sendMessage but it does not work.

@TylonHH

TylonHH commented Nov 14, 2025 •

Copy link
Copy Markdown

Beware of scam or phishing, there a tons of them. So do your own research, even with my suggestion:

Add @my_id_bot to your group chat and send this /id@my_id_bot

@issa-me-sush

Copy link
Copy Markdown

use @username_to_id_bot and choose the channel/chat(group) to get the chat id

@pythonpetar-cloud

pythonpetar-cloud commented Mar 11, 2026 •

Copy link
Copy Markdown

I am just checking those 4 sections and here are the results:

  1. Get Chat ID for a Private Chat
    (still works with no change)
  2. Get Chat ID for a Channel
    (still works with 1 change, we don't need to send any message to the channel to get the channel chat ID)
  3. Get Chat ID for a Group Chat
    (this still works for public group, but not for private group. I will update the post with new section for private group chat)
  4. Get Chat ID for a Topic in a Group Chat
    (this still works no change)

Hi @nafiesl thanks for your efforts. I just created a bot and got my bot token. Also opened a private chat with it. I did not invite it into any group or so. It is just for me.

When I open the website https://api.telegram.org/bot7692xx035:Axx5qa79SSxxxVFpU/getUpdates I see the following:

image There is no result being shown anymore.

Thanks for your help

@pythonpetar-cloud

Copy link
Copy Markdown

In the Telegram app in your Bot , you should click " start " first to activate it.

@Bothardy

Bothardy commented Apr 11, 2026 •

Copy link
Copy Markdown

add "bot" before org/8455119359 solve this
example : https://api.telegram.org/bot8455119359:AAEcccc43e1zdqEkE16WPYJX-0wg/getUpdates

@BourbonCrow

Copy link
Copy Markdown

If ppl late to party like me .. The way I figured it out the {“ok” : true, “result”:[ ] } issue was I sent a hello message to bot or any text that's not just a command and the went to url again and it worked

@zia-monitor

Copy link
Copy Markdown

En la aplicación Telegram de tu Bot, primero debes hacer clic en "iniciar" para activarlo.

exacto, deben abrir su bot que acaban de crear y darle /start

@behruz1233

Copy link
Copy Markdown

ok

@alanwtom

alanwtom commented Nov 4, 2026

Copy link
Copy Markdown

For anyone who'd rather not read the getUpdates JSON: I made a free chat ID finder. Paste the bot token and it lists every chat that messaged the bot, with each ID ready to copy. It runs in your browser, and the token goes straight to api.telegram.org and nowhere else; nothing is saved. Disclosure: I make Fwrd, an iPhone app that forwards texts to Telegram, Slack and more, which is why I built it. https://www.fwrdsms.com/tools/telegram-chat-id

@alanwtom

alanwtom commented Nov 4, 2026

Copy link
Copy Markdown

For anyone who'd rather not read the getUpdates JSON: I made a free chat ID finder. Paste the bot token and it lists every chat that messaged the bot, with each ID ready to copy. It runs in your browser, and the token goes straight to api.telegram.org and nowhere else; nothing is saved. Disclosure: I make Fwrd, an iPhone app that forwards texts to Telegram, Slack and more, which is why I built it. https://www.fwrdsms.com/tools/telegram-chat-id

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