# MSTeamsAlertChannel Construct - Checkly Docs

> Learn how to configure Microsoft Teams alert channels with the Checkly CLI.

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

---

Back to top
- Configuration Microsoft Teams alert channel options
- General alert channel options

Alert Channels

# MSTeamsAlertChannel Construct

Learn how to configure Microsoft Teams alert channels with the Checkly CLI.

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

Sends alert notifications to a Microsoft Teams channel via a Workflow webhook.

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

const msTeamsAlertChannel = new MSTeamsAlertChannel('msteams-channel-01', {
name: 'ACME alerts',
url: 'https://prod-24.westus.logic.azure.com:443/workflows/xxxxx',
})
```

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

const msTeamsAlertChannel = new MSTeamsAlertChannel('msteams-channel-01', {
name: 'ACME alerts',
url: 'https://prod-24.westus.logic.azure.com:443/workflows/xxxxx',
sendRecovery: true,
sendFailure: true,
sendDegraded: true,
sslExpiry: true,
sslExpiryThreshold: 14,
payload: `{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "{{ALERT_TITLE}}",
"weight": "Bolder",
"size": "Large",
"style": "heading"
},
{{#if AI_ANALYSIS_CLASSIFICATION}}
{
"type": "TextBlock",
"text": "AI analysis",
"weight": "Bolder",
"size": "Default",
"style": "heading"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "{{AI_ANALYSIS_CLASSIFICATION}}",
"weight": "Bolder",
"wrap": true
},
{
"type": "TextBlock",
"text": "{{AI_ANALYSIS_ROOT_CAUSE}}",
"wrap": true
}
]
}
]
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "Read full analysis",
"url": "{{AI_ANALYSIS_LINK}}",
"style": "positive",
"iconUrl": "icon:Sparkle"
}
]
},
{{/if}}
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Response time: {{RESPONSE_TIME}}ms",
"wrap": true
},
{
"type": "TextBlock",
"text": "Location: {{RUN_LOCATION}}",
"wrap": true
},
{
"type": "TextBlock",
"text": "Timestamp: {{STARTED_AT}}",
"wrap": true
},
{{#if GROUP_NAME}}
{
"type": "TextBlock",
"text": "Group: {{GROUP_NAME}}",
"wrap": true
},
{{/if}}
{
"type": "TextBlock",
"text": "Tags: {{#each TAGS}} {{this}} {{#unless @last}},{{/unless}} {{/each}}",
"wrap": true
}
]
}
]
}
]
}
],
"actions":[
{
"type":"Action.OpenUrl",
"title":"View in Checkly",
"url":"{{RESULT_LINK}}",
"style": "positive"
}
]
}
}
]
}`
})
```

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

### Microsoft Teams alert channel options

string

required

The target URL created by [creating a Workflow in Microsoft Teams](https://www.checklyhq.com/docs/integrations/alerts/msteams).

string

Friendly name to recognize the integration.

string

Custom payload for the alert message. If this is not specified, we’ll send a default payload with 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. Here’s an example payload, using the default one that we provide:

```
new MSTeamsAlertChannel('msteams-channel-01', {
name: 'ACME alerts',
url: 'https://prod-24.westus.logic.azure.com:443/workflows/xxxxx',
payload: `{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "{{ALERT_TITLE}}",
"weight": "Bolder",
"size": "Large",
"style": "heading"
},
{{#if AI_ANALYSIS_CLASSIFICATION}}
{
"type": "TextBlock",
"text": "AI analysis",
"weight": "Bolder",
"size": "Default",
"style": "heading"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "{{AI_ANALYSIS_CLASSIFICATION}}",
"weight": "Bolder",
"wrap": true
},
{
"type": "TextBlock",
"text": "{{AI_ANALYSIS_ROOT_CAUSE}}",
"wrap": true
}
]
}
]
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.OpenUrl",
"title": "Read full analysis",
"url": "{{AI_ANALYSIS_LINK}}",
"style": "positive",
"iconUrl": "icon:Sparkle"
}
]
},
{{/if}}
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Response time: {{RESPONSE_TIME}}ms",
"wrap": true
},
{
"type": "TextBlock",
"text": "Location: {{RUN_LOCATION}}",
"wrap": true
},
{
"type": "TextBlock",
"text": "Timestamp: {{STARTED_AT}}",
"wrap": true
},
{{#if GROUP_NAME}}
{
"type": "TextBlock",
"text": "Group: {{GROUP_NAME}}",
"wrap": true
},
{{/if}}
{
"type": "TextBlock",
"text": "Tags: {{#each TAGS}} {{this}} {{#unless @last}},{{/unless}} {{/each}}",
"wrap": true
}
]
}
]
}
]
}
],
"actions":[
{
"type":"Action.OpenUrl",
"title":"View in Checkly",
"url":"{{RESULT_LINK}}",
"style": "positive"
}
]
}
}
]
}`
})
```

### 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/msteams-alert-channel.mdx)[Raise issue](https://github.com/checkly/docs/issues/new?title=Issue%20on%20docs&body=Path:%20/constructs/msteams-alert-channel)

[IncidentioAlertChannel Construct Previous](https://www.checklyhq.com/docs/constructs/incidentio-alert-channel)[TelegramAlertChannel Construct Next](https://www.checklyhq.com/docs/constructs/telegram-alert-channel)

[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)
