Enabling Upptime Telegram Notifications | BotFather

Upptime is a very useful tool for website uptime monitoring. If you are not getting notified when your websites are down, there is no point in tracking them in the first place.
Creating a bot is fairly easy. You can start the process by just writing to @BotFather and following the instruction. After the bot creation, you should have your bot token
. You should also start the chat for your newly created bot with /start
(or writing anything would work too).
By using your token
you can retrieve the chat_id
from the telegram api.
https://api.telegram.org/bot<token>/getUpdates
Replace <token>
with your token and send a GET
request to the url. The response will have your chat_id
.
{
"ok": true,
"result": [
{
"update_id": 000000000,
"message": {
"message_id": 000000000,
"from": {},
"chat": {
"id": 00000000, // <- here
"first_name": "",
"username": "",
"type": "private"
},
"date": 0000000000,
"text": "/start",
"entities": []
}
}
}
Your chat_id
will be in result[0].message.chat.id
If your chat id is correct you can retrieve chat history with;
https://api.telegram.org/bot<token>/getChat?chat_id=<chat_id>
To verify that your bot can send messages;
https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat_id>&text=Hello
Last step is to add Github
secrets to your repository.
Name | Secret |
---|---|
NOTIFICATION_TELEGRAM | true |
NOTIFICATION_TELEGRAM_BOT_KEY | <token> |
NOTIFICATION_TELEGRAM_CHAT_ID | <chat_id> |