Sending Notifications from Uptime Kuma to Telegram

  ·   3 min read

Uptime Kuma is an open-source self-hosted status monitoring solution that allows you to track the uptime and performance of various services. It offers a user-friendly interface and provides multiple notification options to alert users when a service goes down or when certain conditions are met. One of the most popular ways to receive notifications is through Telegram, a robust messaging app that supports bot integration. In this article, we will walk through the setup process to send notifications from Uptime Kuma to Telegram.

Prerequisites

Before diving into the configuration, ensure you have the following prerequisites set up:

  1. Uptime Kuma: Make sure you have Uptime Kuma installed and running. You can use Docker or set it up manually on a server.
  2. Telegram Account: You need an active Telegram account to create a bot.
  3. Telegram Bot: You need to create a Telegram bot to send messages.

Step 1: Creating a Telegram Bot

  1. Open Telegram and search for the “BotFather” using the search bar.
  2. Start a chat with BotFather by clicking the “Start” button.
  3. Use the command /newbot to create a new bot. You will be required to provide a name and a username for your bot.
  4. Once the bot is created, BotFather will provide you an API token. Keep this token secure as it will be used to authenticate your bot.

Step 2: Getting Your Chat ID

To send notifications, you’ll need your chat ID (or group ID if you want to send messages to a Telegram Group).

  1. Start a chat with your newly created bot by searching for it in Telegram and sending a message, such as “Hello!”

  2. To find your chat ID, you can call the Telegram API in your browser or through tools like Postman. Use the following URL, replacing YOUR_BOT_TOKEN with the API token you received from BotFather:

    https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates
    
  3. In the JSON response, look for "chat" and find the id field; that’s your chat ID.

Step 3: Configure Uptime Kuma to Send Notifications to Telegram

  1. Log in to your Uptime Kuma instance.

  2. Navigate to the “Settings” page.

  3. In the “Integrations” section, locate the Telegram configuration area.

  4. Fill out the required fields:

    • API Token: Enter the bot token you received from BotFather.
    • Chat ID: Enter the chat ID you retrieved.
  5. Adjust the notification conditions such as service down, service recovery, etc., according to your needs.

  6. Save the configuration.

Step 4: Testing the Notification System

To ensure everything works as expected, you can simulate a service down scenario within Uptime Kuma. The platform should trigger a notification to your specified Telegram chat or group. Here’s how you can test:

  1. Go to your monitored services and change the status of one to “Down.”
  2. Wait a few minutes, and you should receive a Telegram message confirming the service is down.
  3. Restore the service to “Up” and verify that you also receive a recovery notification.

Conclusion

Integrating Uptime Kuma with Telegram notifications is a straightforward process, allowing you to stay informed about your services’ status in real-time. This combination can significantly enhance your monitoring toolkit and ensure timely responses to downtime incidents.

By following the steps outlined in this article, you can set up a reliable notification system that leverages both Uptime Kuma’s monitoring capabilities and Telegram’s messaging features.

This open-source approach keeps your monitoring flexible and tailored to your needs. Happy monitoring!