Slack — Alert Notifications
The CritterWatch.Slack package posts CritterWatch's alert lifecycle to Slack as rich Block Kit messages: raised, elevated, reduced, resolved, cleared, acknowledged, and snoozed. Lifecycle updates reply in-thread to the original alert message, so one alert is one conversation.
bash
dotnet add package CritterWatch.SlackConfiguration
Register it on the CritterWatch host (the application that runs AddCritterWatchServices — not the monitored services):
cs
opts.AddCritterWatchSlack(slack =>
{
// A Slack Bot OAuth token with chat:write scope (required).
slack.BotToken = Environment.GetEnvironmentVariable("SLACK_BOT_TOKEN")!;
// Where alert notifications land by default.
slack.DefaultChannel = "#critterwatch-alerts";
// Critical-severity alerts can route to a dedicated channel.
slack.CriticalChannel = "#ops-critical";
});The bot token is required and validated at startup — create a Slack app with the chat:write scope, install it to your workspace, and invite the bot to the target channels.
Routing and filtering
SlackConfiguration routes and filters notifications:
DefaultChannel— where alerts land unless something more specific matches.CriticalChannel— critical-severity alerts route here when set.AlertTypeChannels— pin specific alert types (e.g."ProjectionLag") to specific channels; takes precedence over both channels above.MinimumSeverity— notifications below this are skipped (default"Warning", i.e. Warning + Critical notify, Info doesn't).UseThreads— lifecycle updates (elevated / resolved / …) reply in the original message's thread (defaulttrue); disable to post each event standalone.
Behavior notes
- Posting is best-effort: a Slack API failure is logged as a warning and never disturbs alert evaluation or the console itself.
- Slack handlers are ordinary Wolverine handlers on the CritterWatch host, discovered automatically when the package is registered — no extra wiring.
- Alerts themselves are evaluated (and license-gated) upstream; this package only renders and delivers what the alerting pipeline produces. For generic HTTP delivery instead of Slack, see the built-in webhook notifications.
