How to get Chat ID
What it is for: The bot token is not enough - the bot has to know which chat to send messages to. Every Telegram chat has a unique number - a Chat ID. In this guide we show you how to get it in 2 minutes.
Step 1: Start a chat with your bot
- Open Telegram
- In the search type the username of your bot (e.g.
my_monitoring_alerts_bot) - Click on it and the chat opens
- Click the Start button (big blue, if it is the first time) or write
/start
The bot will not reply yet - that is fine. It is enough that the chat exists.
Step 2: Get the Chat ID via @userinfobot
The easiest way is to use a helper bot that tells you your own Chat ID.
- In Telegram search write
@userinfobot - Open the chat with it and click Start
- It immediately sends you a message with your data, including Id
Example of a reply from userinfobot:
Your info:
Id: 123456789
First: John
Last: Smith
Username: @john_smith
Lang: en
The number at Id is your Chat ID. Copy it.
Alternatively: via the API endpoint
If you do not want to use a helper bot, you can find out the Chat ID via the Telegram API. In your browser, open the URL (replace the token):
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
You will receive a JSON response. In it look for:
{
"result": [
{
"message": {
"chat": {
"id": 123456789,
...
This number is your Chat ID.
getUpdates returns an empty list "result": [], it means your bot has not received any message yet. Send /start or any other message to it via Telegram and try again.
Chat ID for a group chat (optional)
If you want the bot to send messages to a group chat (e.g. the whole team sees the alerts), do this:
- Create a group chat in Telegram (or use an existing one)
- Add your bot as a member of the group (Add member, search the bot username)
- In the group write the command
/start@your_bot_username - Use the
getUpdatesAPI endpoint above - in the response you find the group's chat ID (it is negative, e.g.-987654321)
A group Chat ID starts with a minus. The bot will send messages to the group where all members can see them.
Done. You have both the token and the Chat ID.
These two values are everything you need:
- Bot token - identifies your bot
- Chat ID - where the bot should send messages
Now you enter them into the ePulz.io settings.
Next step:
Link the token and Chat ID with the ePulz.io account so that alerts work.
Linking with ePulz.io ->