notifications: add notificationTypes channel selector to /internal/send-notification#54
Merged
Merged
Conversation
…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>
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.
What
Adds a
notificationTypesparameter to thePOST /internal/send-notificationendpoint so callers can choose whether an announcement fires email only, push only, or both.notificationTypes— one of"email","push","both"."both"when omitted, so existing callers (the notifications dashboard, mobile tests) are unaffected.400.How it threads through
The endpoint doesn't send inline — it inserts a
notificationrow whosedataJSON is later picked up by theAnnouncementmapper. So the channel selection rides along on the row:sendNotification.ts— parses + validatesnotificationTypes, persists it asdata.notification_channels.announcement.ts— readsdata.notification_channels(defaulting tobothfor absent/legacy rows) and gatesbroadcastPushNotificationAnnouncements/broadcastEmailAnnouncementsper user.notifications.ts— addsNotificationChanneltype and the optionalnotification_channelsfield onAnnouncementNotification.Notes
pushcovers both mobile (SNS) push and browser web-push, since both are driven bybroadcastPushNotificationAnnouncements.shouldSendPush/shouldSendEmail) still apply on top of the channel filter.Verification
npm run typecheckpasses clean.🤖 Generated with Claude Code