feat(alertd): KAM-483: re-implement slack integration via webhook targets#269
Merged
feat(alertd): KAM-483: re-implement slack integration via webhook targets#269
Conversation
KAM-483 Adds Slack as a target type alongside email in alertd. Slack targets are configured in _targets.yml with a webhook URL and optional custom fields. Multiple target types can share the same ID, so an alert can notify both email and Slack simultaneously. Changes: - Add targets/slack.rs with TargetSlack (webhook + fields) - Introduce TargetConnection enum (Email | Slack) to replace the previous email-only ExternalTarget.conn - Add http_client to InternalContext for Slack webhook POSTs - Update ResolvedTarget::send() to dispatch by target type - Remove facet dependency (unused outside derives) - Add url crate with serde feature for webhook URL parsing - Update TARGETS.md and ALERTS.md documentation No breaking changes to existing email-only configurations. Generated-With: Claude
…lack-integration # Conflicts: # Cargo.lock # Cargo.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-implements Slack integration in alertd. Slack targets are configured in
_targets.ymlwith a webhook URL and optional custom fields. Multiple target types can share the same ID, so an alert can notify both email and Slack simultaneously.Context
KAM-483 — Slack alerts were removed along with Zendesk in an earlier simplification, but it turns out at least one deployment (Aspen) relied on Slack alerts because email alerts to Zendesk didn't work properly. This caused confusion where alerts appeared to be working (email) while support couldn't see them (Slack).
Changes
targets/slack.rs: NewTargetSlackstruct with webhook URL and configurable fields, adapted from the legacybestool tamanu alertsimplementationtargets.rs: IntroduceTargetConnectionenum (Email | Slack) replacing the email-onlyExternalTarget.conn; target type is auto-detected from YAML fields (addresses→ email,webhook→ slack)alert.rs/daemon.rs: Addhttp_client: reqwest::ClienttoInternalContextfor webhook POSTsscheduler.rs/events.rs: Pass HTTP client through toResolvedTarget::send()facetdependency: Was only used in derives, not neededurlcrate with serde feature for webhook URL parsingTARGETS.mdandALERTS.mdNo breaking changes
Existing email-only
_targets.ymlconfigurations continue to work unchanged. Slack is purely additive.Example
_targets.yml