Skip to content

notifications: add notificationTypes channel selector to /internal/send-notification#54

Merged
dylanjeffers merged 1 commit into
mainfrom
notifications/send-notification-channels
Jun 6, 2026
Merged

notifications: add notificationTypes channel selector to /internal/send-notification#54
dylanjeffers merged 1 commit into
mainfrom
notifications/send-notification-channels

Conversation

@dylanjeffers

Copy link
Copy Markdown
Contributor

What

Adds a notificationTypes parameter to the POST /internal/send-notification endpoint so callers can choose whether an announcement fires email only, push only, or both.

  • Request field: notificationTypes — one of "email", "push", "both".
  • Defaults to "both" when omitted, so existing callers (the notifications dashboard, mobile tests) are unaffected.
  • Invalid values are rejected with 400.

How it threads through

The endpoint doesn't send inline — it inserts a notification row whose data JSON is later picked up by the Announcement mapper. So the channel selection rides along on the row:

  1. sendNotification.ts — parses + validates notificationTypes, persists it as data.notification_channels.
  2. announcement.ts — reads data.notification_channels (defaulting to both for absent/legacy rows) and gates broadcastPushNotificationAnnouncements / broadcastEmailAnnouncements per user.
  3. notifications.ts — adds NotificationChannel type and the optional notification_channels field on AnnouncementNotification.

Notes

  • push covers both mobile (SNS) push and browser web-push, since both are driven by broadcastPushNotificationAnnouncements.
  • Per-user notification settings (shouldSendPush / shouldSendEmail) still apply on top of the channel filter.

Verification

  • npm run typecheck passes clean.

🤖 Generated with Claude Code

…nd-notification

Lets callers choose whether an announcement fires email only, push only,
or both. Adds a `notificationTypes` request field ("email" | "push" |
"both") validated at the endpoint and persisted on the notification row's
`data.notification_channels`. The Announcement mapper reads it and gates
the push/email broadcasts accordingly.

Defaults to "both" when omitted (and for pre-existing rows), so existing
callers are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dylanjeffers dylanjeffers merged commit e8bb450 into main Jun 6, 2026
36 checks passed
@dylanjeffers dylanjeffers deleted the notifications/send-notification-channels branch June 6, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant