New Options in #Firebase Notifications
The Firebase console now lets your app send notifications to users based on conditions like where they live, or whether they've made app purchases.
Join the DZone community and get the full member experience.Join For Free
Firebase Notifications give you a way of sending notifications to users of your app using minimal coding, using the Firebase console.
It’s built on Firebase Cloud Messaging, an infrastructure that handles over a trillion messages a week, with messages being delivered to most connected devices in less than 500ms. In the initial release of Firebase, we allowed you to pick the users for a notification based on Analytics Audience membership, language, or a specific app version.
But now we’ve added a set of enhancements to how you tightly build your set of users to send notifications to — including building them based on analytics segments, user properties, and more. This is important — notifications can be annoying if there are too many, or if they are irrelevant, so accurately targeted ones give a far greater chance of user engagement.
First of all, you can now pick user audiences when you target a user segment in the notifications composers; for example, if I create an audience in analytics and name it — such as an audience of people in Canada, or who speak French Canadian, as a group called Canadians.
Then, in the notifications composer, I can pick the app (if there’s more than one in this project), and specify Canadians as the user audience I want to send notifications to!
You can also stack conditions. So, for example, there’s a property for people who make in-app purchases, so if I only want to send a notification to Canadians who have not made an in-app purchase, I can do that.
Using these combinations, as well as the ability to create multiple audiences and filter on them, you’ll get fine-grained control over which users will receive your notification. In addition to this, you can also filter on user properties. A user property is one that you define that’s specific to your app — for example, if you’re building a fitness app, you might set a user property that is set to true once the user has walked 100 miles using the app.
Then, when composing a notification, you can add this user property. It can also be implemented alongside the others, so, for example, I could build on the previous example — and send a notification to Canadians who have walked more than 100 miles. Or in their case more than 160km.
There are lots of options for how you would match contents; maybe you want a string that contains a substring, or the opposite — only send to people that don’t match a particular substring.
You can also use regular expressions for maximum granular control. Of course, if your property is numeric, you have all the standard comparators too!
With these tools, you’re equipped to more accurately target your notifications, and hopefully, improve response rates and avoid notification spam!
Published at DZone with permission of Laurence Moroney, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.