For general information about alerting, see our docs on Microsoft Teams alerts and alerting with Checkly.
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().Configuration
Microsoft Teams Alert Channel Options
string
required
The target URL created by creating a Workflow in Microsoft Teams.
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 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. Default value is
true.boolean
Whether to send notifications when checks become degraded. Default value is
false.boolean
Whether to send notifications when a SSL/TLS certificate is about to expire. Default value is Learn more about SSL alerts.
false.new EmailAlertChannel("email-channel-1", {
address: "alerts@acme.com",
sslExpiry: true,
sslExpiryThreshold: 30, // Alert 30 days before expiry
})
number
Number of days before the SSL/TLS certificate expiry date to send notifications. Only relevant when Learn more about SSL alerts.
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
})