Closed nathando closed 4 years ago
okay after digging a bit deeper it seems that it's because of this part of the code
def _cm_send_request(
...
if cloud_type == "FCM" and use_fcm_notifications:
notification_payload = {}
if "message" in data:
notification_payload["body"] = data.pop("message", None)
for key in FCM_NOTIFICATIONS_PAYLOAD_KEYS:
value_from_extra = data.pop(key, None)
if value_from_extra:
notification_payload[key] = value_from_extra
value_from_kwargs = kwargs.pop(key, None)
if value_from_kwargs:
notification_payload[key] = value_from_kwargs
if notification_payload:
payload["notification"] = notification_payload
...
In my data
, I have a title
, which is one of the key in FCM_NOTIFICATIONS_PAYLOAD_KEYS
, so it was automatically pulled out and insert into notification
. Final payload looks like this:
{
"data": {
"data": "{}",
"registration_ids": ["aaaa", "aaaa2"],
"target": "main",
"text": "The title",
"type": "some_type"
},
"notification": {
"title": "The title"
},
"registration_ids": ["aaaa", "aaaa2"]
}
I think it is better to at least highlight this behavior in the documentation so that it's less confusing for other users.
I agree. I had the same issue and solved the problem thanks to @nathando
Hi contributors, firstly thank you for your great package!
I have an issue regarding the "data" message format of FCM.
So following example in the doc, I send the data message only format (the only difference is that I send from a queryset instead of actual device):
However, on my FCM console's report, it shows only
Notification
type andData
type is empty. The current version I am using is 1.6.1, which is supposed to be the latest as well. Not sure if anyone encountered the same issue and how to solve this. If it is really not working, then I believe it is a bug.