Skip to content
Last9 named a Gartner Cool Vendor in AI for SRE Observability for 2025! Read more →
Last9

Receive Alert Notifications via Telegram

Setup Telegram integration and receive alert notifications from Last9.

Getting started

Last9 can send alert notifications and resolutions to Telegram chats, groups, or channels. This document provides step-by-step instructions on how to set up Telegram integration with Last9 and start receiving alert notifications.

Prerequisites

  • A Telegram account
  • A Telegram Bot (created via BotFather)
  • The Chat ID of the group, channel, or private chat where you want to receive alerts

Setting up a Telegram Bot

  1. Open Telegram and search for @BotFather

  2. Start a conversation and send /newbot

  3. Follow the prompts to:

    • Choose a name for your bot (e.g., “Last9 Alerts Bot”)
    • Choose a username for your bot (must end in bot, e.g., last9_alerts_bot)
  4. BotFather will provide you with a Bot Token. It looks like:

    123456789:ABCdefGHIjklMNOpqrsTUVwxyz
  5. Save this token securely - you’ll need it for the webhook URL

Getting your Chat ID

For a private chat with the bot:

  1. Start a conversation with your bot
  2. Send any message to the bot
  3. Visit: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  4. Find the chat.id in the response

For a group:

  1. Add your bot to the group
  2. Send a message in the group mentioning the bot
  3. Visit: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  4. Find the chat.id (group IDs are negative numbers like -1001234567890)

For a channel:

  1. Add your bot as an administrator to the channel
  2. Forward a message from the channel to @userinfobot
  3. The bot will reply with the channel ID

Setting up a notification channel in Last9

  1. In Notification Channels, click Add to create a new channel

    Notification channels list

  2. Provide the following details:

    • Channel Name: A descriptive name to easily identify the channel (e.g., “Telegram Production Alerts”)
    • Channel: Select Webhook from the dropdown
    • Webhook URL: Enter your Telegram Bot API URL:
      https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage
    • Headers: Add the following header:
      KeyValue
      TELEGRAM_CHAT_IDYour chat/group/channel ID (e.g., -1001234567890)
    • Send Resolved: Enable this option if you want to be notified when an alert has been resolved

    Add webhook channel

  3. Click Save to enable the channel

The TELEGRAM_CHAT_ID header is required. Without it, Last9 cannot send messages to your Telegram chat.

Assigning a notification channel to an alert group

  1. Navigate to your Alert Group in Alert Studio

  2. Click on the notification channel icon to configure notifications

  3. Select your Telegram channel from the dropdown

Telegram Notification Format

Last9 sends notifications to Telegram using HTML formatting. Notifications include:

FieldDescription
Event TypeTRIGGER or RESOLVED indicator with emoji
SummaryAlert title and description
SeverityBREACH (critical) or THREAT (warning) with color indicators
ComponentThe affected component or service
ClassType of alert (e.g., Static Threshold, SLO Breach)
TimestampWhen the alert was triggered
Custom DetailsAdditional context like service, environment, error rates
Inspect LinkDirect link to view the alert in Last9

Severity Indicators

SeverityIconDescription
BreachRed circleCritical alerts requiring immediate attention
ThreatOrange circleWarning alerts indicating potential issues
ResolvedCheckmarkAlert has been resolved

Using Terraform

You can also create the Telegram notification channel using the Last9 Terraform Provider:

resource "last9_notification_channel" "telegram" {
name = "telegram-production-alerts"
type = "webhook"
destination = "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage"
send_resolved = true
headers = {
TELEGRAM_CHAT_ID = "-1001234567890"
}
}

Troubleshooting

Notifications not appearing in Telegram

  1. Verify the bot token is correct
  2. Ensure the TELEGRAM_CHAT_ID header is set correctly
  3. Check that the bot has permission to send messages:
    • For groups: the bot must be a member of the group
    • For channels: the bot must be an administrator
  4. Verify the chat ID is correct (groups/channels have negative IDs)

Bot not responding

  1. Make sure you haven’t blocked the bot
  2. For groups, ensure the bot has been added to the group
  3. Check if the bot token is still valid (tokens can be revoked via BotFather)

Messages truncated

Telegram has a 4096 character limit per message. If your alerts contain very long custom details, some content may be truncated.

Alternative header name

Last9 also accepts TELEGRAM_CHAT_ID_KEY as an alternative to TELEGRAM_CHAT_ID.

Please get in touch with us on Discord or Email if you have any questions.