Telegram Token, Bot ID, and Group ID
Telegram Bot Token and Chat/Group ID
Steps to Create Telegram Bot and Get Bot Token, Chat ID, and Group ID
-
Create a Bot via @BotFather
- Search for
@BotFather
on Telegram. - Type
/newbot
and follow the instructions. - Enter the Bot Name (can be any name, doesn't need to include "bot").
- Enter the Bot Username (must end with
bot
, e.g.,ExampleHelperBot
). - After that, you will receive your Bot Token.
- Search for
-
Check Your Bot Token
- Copy the token from @BotFather.
- Open this link in your browser:
https://api.telegram.org/bot<YOUR_TOKEN>/getMe
Example result:
{ "id": 1243XXX408, "is_bot": true, "username": "ExampleHelperBot" }
- This ID is your Bot ID (if
is_bot = true
).
-
Get Chat ID or Group ID
- Send a message to your bot on Telegram (e.g., "Hello").
- Then visit:
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
- Check the JSON response for something like:
"message": { "chat": { "id": -486XXX6383, "title": "Group Title", "type": "group" }, "text": "Hello" }
- Use the appropriate ID:
- User Chat ID: e.g.,
1243XXX408
- Group ID: e.g.,
-486XXX6383
- Supergroup ID: usually starts with
-100
, e.g.,-1001234567890
- User Chat ID: e.g.,
-
Make Sure Your Bot is Connected
- The bot must be a member of the group to receive messages.
- If you're chatting privately, type
/start
to activate it. - Chat ID may not appear if the bot has never received a message from that user or group.
-
Validate Connection
- Use
/getUpdates
to check if your bot is receiving messages. - Common error:
403
: Token is valid, but chat ID is wrong or bot is not allowed.- Solution: Send a message to the bot or invite it to the group and ensure it has permission.
- Use
20a-250716r01p01t01
Comments
Post a Comment
We reserve the right to edit or delete comments that do not comply with our comments policy