olucurious/PyFCM

Analytics label

Closed this issue · 5 comments

According to firebase latest docs it is possible to send an object with the fcm_options in order to tag each notification and filter them on the notification analytics.

https://firebase.google.com/docs/cloud-messaging/understand-delivery?authuser=0#adding_analytics_labels_to_messages

Is there a way to do this using PyFCM? I've tried sending it over the extra_notification_kwargs key and over the extra_kwargs key as well as over the tag key of the notify_single_device function without success.

Thanks in advance

Seems like you can probably use the extra_kwargs keyword and set it to be {'fcm_options': {'analytics_label': 'value'}}

Did you ever have any luck with this? I tried @jturmel's suggestion, but I haven't seen any analytics data come through on the Firebase console.

Has anyone found the solution? I still don't find the way to add the field label to the message.

To everyone who is still looking for a solution, I have spoken with FCM and they said:

"Make sure that the message has been sent using the HTTPv1 API and not the legacy HTTP API. Analytics labels are currently only supported with the HTTPv1 API."

So, sending the message with "fcm_options": { "analytics_label": "testing" } and using HTTPv1 with ouath2 should be enough.

I don't know if pyfcm already support HTTPv1, but I think I can access to the FCM options as they do here.

Suggestions are welcome!

Thanks @jbozas

The bad thing about the newer API is it doesn't support managing device groups, only individual devices so then you have to use a mix of the two.