Notifications Logic

Logic Trees for Creating & Sending Notifications

Overview

When Buzzbuzz is informed of an event via a NATS message (e.g. a new NATS message on the subject messenger.change_feed.message.createdV1) that it understands, it runs that event through hardcoded logic which determines:

  1. Which users theorically could be notified. (e.g., who are the room members?) Hopefully, the event provides a userIds array so this can be done without any queries to other services.

  2. For each user, what do their `UserNotificationPreferences tell us about whether they want to be notified through a specific channel of a specific event?

  3. Based on whether or not a user wants to be notified through a specific channel, should we create a notification at all? (For example, if a user does not want to be notified of new messages in a specific room via push or email, we should likely not create a notification record even if they are a room member, but if they were mentioned in the message we should create a notification record irrespective of whether they wish to recieve a push or email notification. That is to say, the relationship between UserNotificationPreferences, push/email as channels, and each specific type of event is complex and varied.)

  4. If we did decide to create a notification record in the previous step, should we also notify the user through one or more channels? If so, we need to add a message to the buzzbuzz.send.mobile_pushV1 and/or buzzbuzz.send.emailV1 subjects.

  5. If we did create a notification record, we need to publish that via NATS message to notify the Dealer service that the user has a new notification to download.

This is also applicable to notifications that don't get streamed to Buzzbuzz via NATS, but rather are the result of Buzzbuzz's own Temporal workflows or its gRPC endpoint.

Message Sent

Invite Created

Space Membership

Created

Updated

Room Membership

Created

Updated

Daily Digest

(This is not an external event, it runs via a Buzzbuzz Temporal scheduled workflow.)

User Reminders

(This is not an external event, reminders are run via a Buzzbuzz Temporal workflow.)