Prerequisites
Prerequisites
- A Telegram bot and its HTTP API token
- The Chat ID for the direct chat, group, or channel that should receive alerts
- Optional: the Message Thread ID for a specific Telegram forum topic
Telegram Bot
-
Create a Telegram Bot using the @BotFather. Detailed instructions can be found here, however you can simply message the Telegram user
@BotFatherand send them the command message/newbot. Then follow the instructions the bot replies with.
-
As the last step of creating your new bot, the BotFather should reply with a message congratulating you that everything is complete and include a new HTTP API Token for you to use. Alternatively, if you want to reuse an existing Telegram bot you can message the BotFather with the command message
/tokenand they will generate a new token. Make sure to copy this token value out as we’ll be using it in the Checkly setup later. -
Start your new Telegram bot by opening a chat with it. You can use the START button in the UI or type the
/startcommand message.
Chat ID
For direct messages, you can retrieve your user Chat ID with an ID bot. For groups and forum topics, query the Telegram API to retrieve the target group’s Chat ID and optional Message Thread ID.ID Bot
You can retrieve your own Telegram Chat ID by starting a chat with another bot. This Telegram bot user can be found at@get_id_bot.
- Send the
@get_id_botbot the/my_idcommand. Copy the ID from its reply.
API Query
Use the bot API to retrieve a Chat ID for any target chat. For a forum group, the same response includes the Message Thread ID, which Telegram also calls the topic ID.- Add your bot to the target chat or group. If you want alerts in a specific forum topic, send the bot a command from that topic.
-
In a browser, open
https://api.telegram.org/bot<API_TOKEN>/getUpdates, replacing<API_TOKEN>with your bot’s API token.
-
Find the message in the
resultarray and copy these values:message.chat.id: the Chat IDmessage.message_thread_id: the optional Message Thread ID for the forum topic
Telegram update
The
getUpdates method does not work while your bot has an outgoing webhook configured. In that case, retrieve these fields from the update sent to your webhook.Checkly Integration
With the HTTP API Token, Chat ID, and optional Message Thread ID in hand, you can create a Telegram alert channel in Checkly.-
Log in to Checkly and navigate to Alert Settings.
Click the “Add more channels” button, find Telegram on the list, and click “Add channel”.

-
Give the alert channel a name and paste the API Token and Chat ID into the dedicated fields. To send alerts to a specific forum topic, also paste its topic ID into Message Thread ID. You can then choose which alerts you want to receive and which checks or check groups should trigger this channel.
Note that we provide a preconfigured message payload, but you may want to edit the payload to modify the Telegram alert message contents. Such as by adding more variables or changing existing variables. Click the “Edit payload” button and reference the “Help & variables” tab.
Alternatives
Telegram also accepts messages via an HTTPGET request. Therefore, you can use the API Token and Chat ID to create a custom Telegram alert channel with a webhook alert channel. The webhook should use the GET method and target https://api.telegram.org/bot<API_TOKEN>/sendMessage?chat_id=<CHAT_ID>&text=Your%20Alert%20Title. To target a forum topic, add &message_thread_id=<MESSAGE_THREAD_ID> before the text parameter. See Telegram’s sendMessage documentation for more information.
Telegram Best Practices
Group vs Direct Messages
- Direct Messages: Use your personal chat ID for personal notifications
- Group Chats: Add the bot to group chats and use the group’s Chat ID for team notifications
- Forum Topics: Use the group’s Chat ID together with the topic’s Message Thread ID
- Channels: Bots can post to channels if added as administrators
Message Formatting
Telegram supports basic formatting in messages:Security Considerations
- Bot Token Security: Keep your bot tokens secure and never share them publicly
- Chat ID Privacy: Chat IDs can be sensitive information, especially for private groups
- Bot Permissions: Only give your bot the minimum necessary permissions in group chats