Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Allow modification of the notification object before it is shown #7556

Open
kgroat opened this issue Aug 15, 2023 · 0 comments
Open

FR: Allow modification of the notification object before it is shown #7556

kgroat opened this issue Aug 15, 2023 · 0 comments

Comments

@kgroat
Copy link

kgroat commented Aug 15, 2023

Operating System

MacOS 13.3.1 on an M1 pro chip

Browser Version

Chrome 115.0.5790.170

Firebase SDK Version

9.23.0

Firebase SDK Product:

Auth, Firestore, Functions, Messaging

Describe your project's tooling

We are deploying a PWA using firebase and using FCM to send push notifications.

Describe the problem

Currently, if you create a campaign to be sent to a web app, it does not allow you to provide certain fields (namely an icon url). It would be nice to be able to intercept the notification object before it is displayed so that I can make sure an icon is specified. I believe this was supported in the old firebase messaging trough messaging.setBackgroundMessageHandler() but there does not appear to be an equivalent in the new modular api.

Steps and code to reproduce issue

I would like to be able to do something like the following:

  const app = initializeApp(firebaseConfig)
  const messaging = getMessaging(app)
  onBackgroundMessage(messaging, (message) => {
    if (message.notification && !message.notification.icon) {
      message.notification.icon = '/icon512.png'
    }
  })
@kgroat kgroat added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Aug 15, 2023
@jbalidiong jbalidiong added needs-attention api: messaging and removed new A new issue that hasn't be categoirzed as question, bug or feature request labels Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants