Use Slack Alert Channels to send notifications to Slack channels when checks fail or recover. The examples below show how to configure Slack alerting for different scenarios.
Copy
Ask AI
import { SlackAlertChannel } from "checkly/constructs"const slackChannel = new SlackAlertChannel("slack-channel-1", { url: new URL( "https://hooks.slack.com/services/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" ), channel: "#ops",})
Slack webhook URL for incoming messages. This is the endpoint where Checkly will send alert notifications.Usage:
Copy
Ask AI
new SlackAlertChannel("slack-channel", { url: new URL( "https://hooks.slack.com/services/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" ), channel: "#alerts",})
Examples:
Copy
Ask AI
const slackChannel = new SlackAlertChannel("direct-slack", { url: new URL( "https://hooks.slack.com/services/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" ), channel: "#monitoring",})
Use cases: Team notifications, webhook integration, secure credential storage, multi-team alerting.
Target Slack channel or user for notifications. Can override the default channel configured in the webhook.Usage:
Copy
Ask AI
new SlackAlertChannel("channel-slack", { url: new URL(process.env.SLACK_WEBHOOK_URL!), channel: "#ops", // Send to #ops channel})
Examples:
Copy
Ask AI
const channelSlack = new SlackAlertChannel("channel-slack", { url: new URL(process.env.SLACK_WEBHOOK_URL!), channel: "#monitoring-alerts", // Public channel})
Use cases: Team-specific alerts, direct notifications, alert categorization, noise management.
Whether to send notifications when checks recover from failure or degraded state.Usage:
Copy
Ask AI
new SlackAlertChannel("recovery-slack", { url: new URL(process.env.SLACK_WEBHOOK_URL!), channel: "#alerts", sendRecovery: true, // Send recovery notifications})
Examples:
Copy
Ask AI
const opsSlack = new SlackAlertChannel("ops-slack", { url: new URL(process.env.SLACK_WEBHOOK_URL!), channel: "#ops", sendRecovery: true, // Get notified when issues are resolved sendFailure: true,})
Use cases: Recovery confirmation, operational awareness, noise reduction.
Whether to send notifications for SSL certificate expiry warnings.Usage:
Copy
Ask AI
new SlackAlertChannel("security-slack", { url: new URL(process.env.SLACK_WEBHOOK_URL!), channel: "#security", sslExpiry: true, sslExpiryThreshold: 30, // Alert 30 days before expiry})
Examples:
Copy
Ask AI
const securitySlack = new SlackAlertChannel("security-slack", { url: new URL(process.env.SLACK_WEBHOOK_URL!), channel: "#security", sendRecovery: false, sendFailure: true, sslExpiry: true, sslExpiryThreshold: 7, // Alert 7 days before expiry})new ApiCheck("ssl-cert-check", { name: "SSL Certificate Check", alertChannels: [securitySlack], request: { method: "GET", url: "https://secure.example.com", },})
Use cases: Certificate management, security compliance, proactive maintenance.
Number of days before SSL certificate expiry to send notifications. Only relevant when sslExpiry is enabled.Usage:
Copy
Ask AI
new SlackAlertChannel('ssl-monitoring', { url: new URL(process.env.SLACK_WEBHOOK_URL!), channel: '#devops', sslExpiry: true, sslExpiryThreshold: 30 // Alert 30 days before expiry})
Examples:
Copy
Ask AI
// Alert close to expiry for urgent actionnew SlackAlertChannel("ssl-urgent", { url: new URL(process.env.SLACK_WEBHOOK_URL!), channel: "#security", sslExpiry: true, sslExpiryThreshold: 7, // 7 days notice})
Use cases: Certificate renewal planning, compliance management, operational scheduling.
Webhook Security: Keep your Slack webhook URLs secure. Anyone with access to the URL can send messages to your Slack channels.
Channel Override: The channel parameter can override the default channel configured in your Slack webhook. Use #channel-name for channels or @username for direct messages.