Skip to main content
For general information about alerting, see our docs on the Telegram integration and alerting with Checkly.
Sends alerts to a Telegram channel.
import { TelegramAlertChannel } from 'checkly/constructs'

const telegramChannel = new TelegramAlertChannel('my-telegramchannel-1', {
  name: 'My Telegram channel',
  apiKey: 'xxxxxx',
  chatId: 'xxxxxx'
})
If you need to reference existing alert channels that were created outside of your CLI project, use fromId().

Configuration

Configure Telegram-specific settings:
ParameterTypeRequiredDefaultDescription
namestring-Friendly name to recognise the integration
apiKeystring-The API key associated with your Telegram bot
chatIdstring-The chat ID of the Telegram channel you want to send alerts to
payloadstringIncludes basic information about the alert, including a link to the check result.The message sent to the chat when an alert is triggered

Telegram Alert Channel Options

name
string
required
Friendly name to recognise the integration.
apiKey
string
required
The API key associated with your Telegram bot.
chatId
string
required
The chat ID of the Telegram channel you want to send alerts to.
payload
string
The message sent to the chat when an alert is triggered. If this is not specified, we’ll send a default payload with some basic information about the alert.We have handlebar helpers and variables available for building custom payloads.
new TelegramAlertChannel('my-telegramchannel-1', {
  name: 'My Telegram channel',
  apiKey: 'xxxxxx',
  chatId: 'xxxxxx',
  payload: `
    <b>{{ALERT_TITLE}}</b> at {{RUN_LOCATION}} ({{RESPONSE_TIME}}ms)
    {{#if AI_ANALYSIS_CLASSIFICATION}}
    AI Analysis: <i>{{AI_ANALYSIS_CLASSIFICATION}}</i>

    {{AI_ANALYSIS_ROOT_CAUSE}}
    <a href="{{AI_ANALYSIS_LINK}}">Read full analysis</a>
    {{/if}}

    Tags: {{#each TAGS}} <i><b>{{this}}</b></i> {{#unless @last}},{{/unless}} {{/each}}
    <a href="{{RESULT_LINK}}">View check result</a>
    `
})

General Alert Channel Options

These options are valid for all alert channels types.
sendRecovery
boolean
Whether to send notifications when checks recover from a failed or degraded state. Default value is true.
sendFailure
boolean
Whether to send notifications when checks fail. Default value is true.
sendDegraded
boolean
Whether to send notifications when checks become degraded. Default value is false.
sslExpiry
boolean
Whether to send notifications when a SSL/TLS certificate is about to expire. Default value is false.
new EmailAlertChannel("email-channel-1", {
  address: "alerts@acme.com",
  sslExpiry: true,
  sslExpiryThreshold: 30, // Alert 30 days before expiry
})
Learn more about SSL alerts.
sslExpiryThreshold
number
Number of days before the SSL/TLS certificate expiry date to send notifications. Only relevant when sslExpiry is enabled. Default value is 30.
new EmailAlertChannel("email-channel-1", {
  address: "alerts@acme.com",
  sslExpiry: true,
  sslExpiryThreshold: 30, // Alert 30 days before expiry
})
Learn more about SSL alerts.