How to get a Chat ID of a Telegram Group.
Use the tool above to get the Chat ID of the group that your Bot is a member of.
- Install Telegram,
- Create a Bot using the official telegram BotFather (it has a verified symbol next to it when you add it as a contact),
- Follow the prompts, and finally copy it’s HTTP API Token,
- Create a Group,
- Add the Bot to it,
- Send the Group at least 1 message.
- Retrieve the Chat ID from the chat data using the above tool.
The tool also show the returned JSON response. You can search the returned JSON data for last chat message with type=group, and copy the chat id from this. This is your Chat ID to use for sending messages to the group.
Alternatively, If you don’t want to use the tool above, you can visit this URL. https://api.telegram.org/botXXX:YYYYY/getUpdates (replace the XXX: YYYYY with your BOT HTTP API Token you just got from the Telegram B otFather)
If the the tool above doesn’t show the Chat ID after you add a valid Bot API token,
- remove your bot from the group,
- re-add your bot to the group,
- Send a message to the group again,
- Try the above tool again.
The source code for this tool can be found at https://codesandbox.io/s/get-telegram-chat-id-q3qkk