I would like to send in-app messages from firebase console to only specific users. For example having gardening application i want to send such message to only those users that have 5-10 plants, next time to users that have 10-15 plants, next time to users that have more than 1 garden etc. What is the best way to do this? I was reading about creating custom definitions, but there are limitations (we can create only 25 user scoped dimensions).
3 Answers
One option, that doesn't use FCM but Realtime DB or Firestore where you allow users to listen to that directory as an inbox. Creating entries in those locations will be received by the client similar to how email works, allowing you to react and notify users based on the contents of the message.
- Firestore: Listen to documents
- Realtime DB: Listen to realtime changes

- 4,225
- 1
- 12
- 20
Using FCM, you must store that user's device token in your database and temporarily subscribe them to that topic when your conditions are met. Verifying these conditions is out of the scope of this question.

- 4,225
- 1
- 12
- 20
So the easiest way to do what you're seeking is indeed using a user property / user-scoped dimension. If adding a new property to track the number of plants is doable for your app within the 25 dimension limit, that would be most advisable since you'll be able to target an audience based off that in your In-App Messages easily.
If that isn't an option, using Cloud Firestore or the Realtime Database as DIGI Byte mentioned could be the way to go if you're okay with creating a custom display / overlay that only shows up conditionally for users with > 10 and <= 15 plants or whichever other rules you want to implement. You wouldn't be able to target users with this method, but you could encode the display rules in Firestore itself if the conditions are fairly simple.
The other approach would be to use Import Segments with a couple of caveats:
- Import Segments are currently in beta.
- This is a bit more involved as a solution, but can allow for the scenario you mentioned as well as many more complicated, custom targeting scenarios too.

- 374
- 1
- 3