-
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
im using JavaScript SDK libraries from the CDN
Detailed Problem Description
The FCM Console Notification Composer (Notification message) allows the addition of extra parameters using the "Custom data" function. I wanted to try adding click_action, body, icon, etc. However, I checked payload and i noticed that these parameters are located in "data"
{
"from":"xxx",
"collapseKey":"xxx",
"messageId":"xxx",
"notification":{
"title":"Test title",
"body":"Test body",
"image":"path-to-img"
},
"data":{
"click_action":"my-custom-url",
"icon":"path-to-icon",
"badge":"path-to-badge",
}Meanwhile, the service worker handles parameters such as click_action, body, and icon only when they are added to "notification". So, what’s the easiest way to define click_action with a link that should open when the notification is clicked? And how can I set the icon parameter directly from the Notification Composer (GUI) – is that even possible?
I should add that when I define a push notification (data message) manually, set the parameters correctly, and then receive the message in onBackgroundMessage, everything works as expected.
Steps and code to reproduce issue
Just try send Push notification from firebase GUI (Notification Composer) and check payload
