# TelegramAlertChannel Construct - Checkly Docs

> Learn how to configure Telegram alert channels and forum topics with the Checkly CLI.

Source: https://www.checklyhq.com/docs/constructs/telegram-alert-channel/

---

Back to top
- Configuration Telegram alert channel options
- General alert channel options

Alert Channels

# TelegramAlertChannel Construct

Learn how to configure Telegram alert channels and forum topics with the Checkly CLI.

For general information about alerting, see our docs on [the Telegram integration](https://www.checklyhq.com/docs/integrations/alerts/telegram) and [alerting with Checkly](https://www.checklyhq.com/docs/communicate/alerts/overview/).

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'
})
```

```
import { TelegramAlertChannel } from 'checkly/constructs'

const telegramChannel = new TelegramAlertChannel('my-telegramchannel-1', {
name: 'My Telegram channel',
apiKey: 'xxxxxx',
chatId: 'xxxxxx',
messageThreadId: '42',
sendRecovery: true,
sendFailure: true,
sendDegraded: true,
sslExpiry: true,
sslExpiryThreshold: 30,
})
```

`messageThreadId` requires Checkly CLI 8.18.0 or later.

If you need to reference existing alert channels that were created outside of your CLI project, use [`fromId()`](https://www.checklyhq.com/docs/constructs/alert-channel#using-fromid-to-reference-an-existing-channel).

## ​ Configuration

### ​ Telegram alert channel options

​

string

required

Friendly name to recognise the integration.

​

string

required

The API key associated with your Telegram bot.

​

string

required

The chat ID of the Telegram channel you want to send alerts to.

​

string

The positive integer Message Thread ID of a Telegram forum topic. Use it together with `chatId` to send alerts to a specific topic.

​

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](https://www.checklyhq.com/docs/integrations/alerts/webhooks/#using-variables) available for building custom payloads.

```
new TelegramAlertChannel('my-telegramchannel-1', {
name: 'My Telegram channel',
apiKey: 'xxxxxx',
chatId: 'xxxxxx',
payload: `
**{{ALERT_TITLE}}** at {{RUN_LOCATION}} ({{RESPONSE_TIME}}ms)
{{#if AI_ANALYSIS_CLASSIFICATION}}
AI Analysis: _{{AI_ANALYSIS_CLASSIFICATION}}_

{{AI_ANALYSIS_ROOT_CAUSE}}
[Read full analysis](https://www.checklyhq.com/docs/constructs/telegram-alert-channel/%7B%7BAI_ANALYSIS_LINK%7D%7D)
{{/if}}

Tags: {{#each TAGS}} _**{{this}}**_ {{#unless @last}},{{/unless}} {{/each}}
[View check result](https://www.checklyhq.com/docs/constructs/telegram-alert-channel/%7B%7BRESULT_LINK%7D%7D)
`
})
```

### ​ General alert channel options

These options are valid for all alert channels types.
​

boolean

Whether to send notifications when checks recover from a [failed or degraded state](https://www.checklyhq.com/docs/communicate/alerts/overview/#alert-channels). Default value is `true`.

​

boolean

Whether to send notifications when checks [fail](https://www.checklyhq.com/docs/communicate/alerts/overview/#alert-channels). Default value is `true`.

​

boolean

Whether to send notifications when checks [become degraded](https://www.checklyhq.com/docs/communicate/alerts/overview/#alert-channels). Default value is `false`.

​

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.](https://www.checklyhq.com/docs/communicate/alerts/ssl-expiration/)

​

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.](https://www.checklyhq.com/docs/communicate/alerts/ssl-expiration/)

Was this page helpful?

[Suggest edits](https://github.com/checkly/docs/edit/main/constructs/telegram-alert-channel.mdx)[Raise issue](https://github.com/checkly/docs/issues/new?title=Issue%20on%20docs&body=Path:%20/constructs/telegram-alert-channel)

[MSTeamsAlertChannel Construct Previous](https://www.checklyhq.com/docs/constructs/msteams-alert-channel)[RetryStrategyBuilder Construct Next](https://www.checklyhq.com/docs/constructs/retry-strategy)

[x](https://x.com/checklyhq)[github](https://github.com/checkly)[linkedin](https://linkedin.com/company/checkly)

[Powered by This documentation is built and hosted on Mintlify, a developer documentation platform](https://www.mintlify.com/?utm_campaign=poweredBy&utm_medium=referral&utm_source=checkly-422f444a)
