-
Notifications
You must be signed in to change notification settings - Fork 987
Description
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"
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) {
const notificationTitle = 'My title';
const notificationOptions = {
body: 'My body msg',
image: 'url-to-my-image',
icon: 'url-to-my-icon',
badge: 'url-to-my-badge',
};
// Show the notification
self.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