ITriggerOverrideFCM Overrides don't match Docs
Having a few issues getting FCM notifications to not trigger twice in the onBackgroundMessage listener of our app using FCM and webPush.
Part of the problem that makes this more confusing is that the Docs on https://docs.novu.co/channels/push/fcm/ don't match up with the types provided.
If I ignore the types provided and follow the docs I have a notification I want to send that looks like
I get this error in the activity feed
If I remove the "type" data I get this error
There seems to be override and parsing errors
Firebase Cloud Messaging | Novu
Firebase Cloud Messaging is a free notification delivery service provided by Google Firebase.
4 Replies
It appears that the issue might be related to the type field in your overrides object and the non-string values in the data object.
According to a discussion here: https://discord.com/channels/895029566685462578/1072461424061841450, when type is set to data, the message payload is sent, but the title and message fields are omitted from the template. It is recommended not to change the type field and instead add the data key in the overrides object.
Additionally, all fields in the data object should be strings.
To fix the issue, remove the type field from your overrides, and ensure all fields in your payload object have string values.
If the problem persists, let us know
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Thanks there's some good stuff in there.
I think the double notification trigger comes from us wanting a data message so we can handle it manually in the background. It seems like you can only send notification messages with Novu at the moment?
From the firebase docs: https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages
I thought the data override would send it as a data message so we can handle it in the background with a listener in the
firebase-messaging-sw.js
like this
however if I send a notification with an override object like this
We can see this payload in the
messaging.onBackgroundMessage
listener
The variables in notification part of the object above gets sent as normal push notification to our devices (which we don't want if we add the data object). If we had put those variables in the now omitted "payload" object then the template we specified on the Novu workflow would have filled them in for us.
It seems like theres no way to send data messages via novu at the moment, or am I missing something key?hi @turtles
Can you please create a bug on github for this?
@turtles ping