How to handle notifications preferences?

Hi all,

I’ve started to implement notifications in my app, and all is fine so far. However, I’d like to let my users decide which kind of notifications they want to receive. How do I take care of this?
As for the notifications; they are generated by a NodeJS app, and then send through https://github.com/expo/expo-server-sdk-node. Right now, I’m using Firebase to store the tokens.

The way I was thinking of was:

  1. User set their preference in the settings screen
  2. an async call sets a property in Firestore
  3. As soon as a notify fires, the NodeJS app gets a list of users that matches the needed preference and than fire the notification to the list of Expotokens that matches.

Is this the right approach? Is this over-kill? As far as I can see, there is no way to handle this entirely in-app (device (either iOS or Android) decides whether to show notification or not).

Thanks in advance!

Derk

Your proposed workflow looks right to me. The client side notification library only really takes care of asking the user for their permission to receive notifications, and then outputting a device/ app token if they agree to them. Everything after that (when to send notifications, what kind to send, who to send them to) is up to you and your server. In your case, there’s no way around storing a preference under the user account server-side (lots of apps do this).

The one possible wrinkle is that you may choose to use notification channels on Android to offer the user some additional customization. In theory, you a user could tell your app in preferences to turn on a type of notification, and then turn off the channel in their device settings. I don’t think channels can replace the server side setting entirely, though, because of iOS, and just because it’s not a great user experience.

1 Like

Thank you for your reply and the validation. I know where to start then!