Cloud messaging condition limits

91 views
Skip to first unread message

Rafael Dutra

unread,
Oct 9, 2024, 11:03:28 AMOct 9
to Firebase Google Group
Hi everyone,

I have a question regarding the limitations of the condition field when sending notifications.

Are there any specific restrictions or limits applied to the condition field? For example, is there a limit on the size of the condition or the number of topics that can be included in a single condition? I haven’t been able to find any documentation addressing this issue so far.

I plan to create multiple topics, ranging from broad to more specific, to send notifications. For instance, I could send a generic notification to all users, or filter out certain groups based on conditions like these:

'all_users' in topics && 'users_active' in topics — Notify all active users
'all_users' in topics && 'users_active' in topics && 'users_city_somewhere' in topics — Notify all active users in a specific city

The challenge starts when I need to be even more specific. For example, not all active users in a city should receive certain notifications. A small group might not qualify, and the qualifications can change dynamically, even minute by minute.

One suggestion I found was to create a topic for each user and then exclude specific users using a condition like this:

'all_users' in topics && 'users_active' in topics && 'users_city_somewhere' in topics && !('user_x' in topics)

However, this could result in very large conditions, which brings me back to my original concern.

Has anyone faced a similar challenge? If so, did you find a better approach to handle such dynamic conditions efficiently?

Thanks in advance for your insights!

Rafael Dutra

unread,
Oct 10, 2024, 11:02:54 AMOct 10
to Firebase Google Group
After searching a little more I found out that is only possible to include up to five topics in each condition.

Joe Spiro

unread,
Oct 10, 2024, 11:04:49 AMOct 10
to Firebase Google Group
For posterity, this limit is documented in Build Send Requests for iOSAndroid and others.
Reply all
Reply to author
Forward
0 new messages