You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to override the imported firebase-js-sdk configuration for displaying push notifications in a service worker that was send via "Notification Composer"? I know that when sending notifications (data messages) via the API, this is possible, and I can do it. However, my problem is that I would like to be able to send push notifications from the Notification Composer, but there, I can't set the "Icon", this is crucial for us. Is there any workaround, for example, writing code before importing and overriding the default function, similar to the situation when i do something like this for change the "click_action"
self.addEventListener('notificationclick',function(event){// here my code for override the click_action URL});
Why is it not possible to directly set the icon from the GUI? it's weird and unintuitive because it seems like a basic feature, just like setting the "image". Especially if we know that icon would be attached if we send notification by API (data message) and have this code in "firebase-messaging-sw.js":
messaging.onBackgroundMessage((payload)=>{console.log('[firebase-messaging-sw.js] Received background message ',payload);if(!payload.notification){constnotificationTitle='My title';constnotificationOptions={body: 'My body msg',image: 'url-to-my-image',icon: 'url-to-my-icon',badge: 'url-to-my-badge',};// Show the notificationself.registration.showNotification(notificationTitle,notificationOptions);}});
Why this parameters cannot be set in "Notification Composer" by using "Additional options" for example like this:
Steps and code to reproduce issue
Send push notification from Notification Composer
The text was updated successfully, but these errors were encountered:
Hi @Mateostin, I am not sure if I fully understand the issue. I see in the reference documentation that if the icon is not present in the notification request, FCM will use the icon found in your apps manifest.
Are you requesting to be able to send icon from the Notification Composer in the Firebase Console? If so, please submit this to Firebase Support so that the Firebase Console team (not us) can see it.
As a temporary workaround, you could try adding an event listener on 'push' events, then try overriding the payload to set the icon. Alternatively, you could use patch-package to override the behaviour of the SDK in externalizePayload.ts. I have not tried either of these myself, so I am not certain whether they will solve your issue.
Hey @Mateostin. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Operating System
Ubuntu 24.04
Environment (if applicable)
Chrome 129.0.6668.58
Firebase SDK Version
10.14.1
Firebase SDK Product(s)
Messaging
Project Tooling
JavaScript SDK libraries from the CDN
Detailed Problem Description
Is there any way to override the imported firebase-js-sdk configuration for displaying push notifications in a service worker that was send via "Notification Composer"? I know that when sending notifications (data messages) via the API, this is possible, and I can do it. However, my problem is that I would like to be able to send push notifications from the Notification Composer, but there, I can't set the "Icon", this is crucial for us. Is there any workaround, for example, writing code before importing and overriding the default function, similar to the situation when i do something like this for change the "click_action"
Why is it not possible to directly set the icon from the GUI? it's weird and unintuitive because it seems like a basic feature, just like setting the "image". Especially if we know that icon would be attached if we send notification by API (data message) and have this code in "firebase-messaging-sw.js":
Why this parameters cannot be set in "Notification Composer" by using "Additional options" for example like this:
Steps and code to reproduce issue
Send push notification from Notification Composer
The text was updated successfully, but these errors were encountered: