Skip to content

Add adapter-level alerting, alert dispatch, and customizable alert payloads#48

Merged
Prateek32177 merged 1 commit intocodex/add-scalable-alerting-integration-for-slack-and-discordfrom
codex/fix-undefined-platform-and-eventid-handling
Mar 3, 2026
Merged

Add adapter-level alerting, alert dispatch, and customizable alert payloads#48
Prateek32177 merged 1 commit intocodex/add-scalable-alerting-integration-for-slack-and-discordfrom
codex/fix-undefined-platform-and-eventid-handling

Conversation

@Prateek32177
Copy link
Contributor

Motivation

  • Enable sending alerts directly from framework adapters and core queue flow so users can receive notifications whether or not they use Upstash controls.
  • Allow consumers to override alert title and message while keeping sensible DLQ/non-DLQ fallbacks.
  • Improve source/eventId resolution and avoid leaking undefined metadata fields when sending control alerts.

Description

  • Introduces a new dispatchWebhookAlert helper (src/notifications/dispatch.ts) and wires adapter-level alerts + alert options into nextjs, express, and cloudflare handlers to send alerts on verification/enqueue.
  • Extends WebhookVerificationService.handleWithQueue and queue handling to dispatch alerts after successful enqueue, and updates queue responses to include platform and eventId when queued.
  • Enhances notification utilities: added robust source/eventId resolution and non-empty string picking in src/notifications/utils.ts, defaulting source to unknown when unresolved, and preventing undefined metadata in control alert payloads via withoutUndefined in src/upstash/controls.ts.
  • Makes Slack and Discord payload builders respect custom title and message while falling back to updated default constants in src/notifications/constants.ts and payload builders.
  • Updates README with adapter-level alert usage examples and documents behavior differences between queue and non-queue modes.
  • Adds tests in src/test.ts to validate custom title/message passthrough and fallback behavior for alerts.

Testing

  • Ran the project test suite with npm test, which included the two new alert tests for custom title/message passthrough and fallback behavior, and confirmed they passed.
  • Exercised handler flows for both queue and non-queue paths manually via unit-style checks in src/test.ts to verify dispatch runs only when alert config is present and successful enqueue/verification occurs.

Codex Task

@Prateek32177 Prateek32177 merged commit f42f528 into codex/add-scalable-alerting-integration-for-slack-and-discord Mar 3, 2026
3 checks passed
@Prateek32177 Prateek32177 deleted the codex/fix-undefined-platform-and-eventid-handling branch March 3, 2026 09:41
Prateek32177 added a commit that referenced this pull request Mar 3, 2026
…replay (#46)

* refactor: make controls.alert primary API for dlq and non-dlq alerts

* payload updated

* Fix missing alert context fields in Slack/Discord notifications (#47)

* Fix alert context propagation for Slack/Discord payloads

* Fix lint errors in notification internals exports

* payload updated

* Centralize alerts and restore backward-compatible payload defaults (#48)

* payload updated

* version upgraded

* updated readme

* updated readme

* docs: README updates for queue support, Upstash QStash, examples, and API reference (#49)

* docs: restore full README sections and keep queue updates

* docs: strengthen README positioning and core SDK usage

* updated readme

* updated readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant