Uptime alerts in Telegram
A message from your own bot when a monitor goes down, when it turns slow, and when it is back. To you, a group, or a channel.
StatOSSAPP02:51
Northwind: API is down
API (https://api.northwind.example/health) is failing.
Error: timeout, 2 checks in a row, confirmed from a second location.
Status page
Setting it up
- In Telegram, message @BotFather, send
/newbot, pick a name and a username, and copy the token it gives. - Add the bot to the group, or to the channel as an admin that can post messages. For alerts to yourself, open the bot and press Start.
- Find the chat ID, as below.
- In StatOSS, open Account, Alerts, choose Telegram under "Add a destination", paste the token and the chat ID, tick the pages whose alerts go there, and add it.
- Press "Send a test" next to it.
Telegram is on Hobby ($4 a month) and Pro. Email alerts are on every plan, Free included. The pricing page has the rest.
Finding the chat ID
Send a message in the chat, then open https://api.telegram.org/bot<token>/getUpdates in a browser with your token in place. The ID is the number under chat, id. A person's ID is a positive number; a group's or a channel's starts with a minus sign. A public channel can be given as its @name instead.
What the message says
The alert's first line in bold, then the monitor, the URL, the reason and the time, and a link to the public page. Link previews are off. When Telegram refuses an alert, the test and the delivery record say why: the chat was not found, the bot was blocked or removed, or the token is not valid. The token is stored encrypted and not shown again; the dashboard names the destination by its chat.
When an alert goes out
One alert per change of state: when a monitor goes down, when it turns slow, and when it is back, with the time, the reason, and how long it was out. A monitor counts as down after two failed checks in a row, each confirmed by a second server on another network; a single failed check sends nothing. A repeat interval sends a "still down" notice every so many minutes while an outage lasts, and nothing is sent during a maintenance window. Every kind of monitor alerts the same way: a website, an API, a port, a certificate, a cron job.