Integrating Sentry Alerts with Telegram

This tutorial guides you through the process of receiving Sentry notifications via Telegram. Follow these steps to set up a dedicated Telegram group that can receive alerts from Sentry.

Prerequisites

Before starting, make sure you have:

  • A Telegram account.

  • Admin rights to create groups and invite bots in Telegram.

  • Access to your Sentry API KEY.

Step 1: Create a Telegram Group

  1. Open Telegram: Use the mobile app or web version at web.telegram.org.

  2. Create a New Group: Go to the menu, select ‘New Group’, and follow the prompts to set up your group. Choose a meaningful name that reflects its purpose.

  3. Add Members: Invite colleagues who need to receive Sentry notifications. You can add or remove members at any time.

  4. Group Creation: Create a new chat group in telegram where you will receive the notification.

Step 2: Invite the Sentry Bot to Your Group

  1. Search for Bot: In the Telegram search bar, type @aleno_sentry_bot and select it from the list.

  2. Invite Bot to Group: Add @aleno_sentry_bot to the group you created. This bot is responsible for sending Sentry alerts to your group.

Step 3: Find Your Telegram Group ID

  1. Open Telegram Web: Go to web.telegram.org.

  2. Navigate to Your Group: Click on your group and observe the URL in the browser’s address bar. It should look something like this: https://web.telegram.org/k/#-XXXXXXXXXX.

  3. Identify Group ID: The part after # is your group ID. For example, in https://web.telegram.org/k/#-4220052561, the group ID is -4220052561. The hyphen '-' is part of the ID.

Step 4: Configure Sentry to Send Alerts to Telegram

  1. Use Sentry API: Use the /account route with your api key to configure sentry to send alerts in your group

curl -X PUT \
  https://sentry.aleno.ai/account \
  -H 'accept: application/json' \
  -H 'Authorization: YOUR_API_KEY' \
  -d '{"telegramChannelId": "YOUR_CHANNEL_ID"}'

Step 5: Test Your Integration

  1. Generate a Test Alert: Trigger a test alert from Sentry with a small threshold to verify that notifications are being sent to your Telegram group.

  2. Adjust Settings as Needed: Depending on the test results, you may need to tweak your alert settings in Sentry.

Last updated