Skip to main content
For general information about alerting, see our docs on Microsoft Teams alerts and alerting with Checkly.
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',
})
If you need to reference existing alert channels that were created outside of your CLI project, use fromId().

Configuration

Configure Microsoft Teams-specific settings:
ParameterTypeRequiredDefaultDescription
urlstring-The target URL created by creating a Workflow in Microsoft Teams
namestring-Friendly name to recognize the integration
payloadstring-Custom payload for the alert message

Microsoft Teams Alert Channel Options

url
string
required
The target URL created by creating a Workflow in Microsoft Teams.
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 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.
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.