> ## Documentation Index
> Fetch the complete documentation index at: https://www.checklyhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MSTeamsAlertChannel Construct

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

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

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

```ts Basic Example theme={null}
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',
})
```

```ts Advanced Example expandable theme={null}
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"
          }
        ]
      }
    }
  ]
}`
})
```

> [!NOTE]
>
> 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

**url** `string` *required*

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

**name** `string`

Friendly name to recognize the integration.

**payload** `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.md#using-variables) available for building custom payloads.

Here's an example payload, using the default one that we provide:

```ts highlight={4-120} expandable theme={null}
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.

**sendRecovery** `boolean`

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

**sendFailure** `boolean`

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

**sendDegraded** `boolean`

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

**sslExpiry** `boolean`

Whether to send notifications when a SSL/TLS certificate is about to expire. Default value is `false`.

```ts highlight={3} theme={null}
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.md)

**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`.

```ts highlight={4} theme={null}
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.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.