Skip to Main Content
Feature Request FR-3868
Product Area APIs
Status CLOSED

2 Voters

Extend the push notification API

pvdn Public
· Jun 26 2024

Idea Summary
Loving the push notification and how easy is to setup. One thing, why aren't all the config options implemented in the API?
https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification

Use Case
Be able to use an image in a notification or buttons to interact with the notification.

Preferred Solution (Optional)
Add all the parameters or maybe even better and more future proof, add the option for a parameter in apex_pwa.send_push_notification to send the options object (instead of the individual parameters).

We reviewed this idea carefully, and while it was interesting, we concluded that it is unlikely to make its way into APEX in the foreseeable future.

Comments

Comments

  • vincent morneau Admin OP 12 months ago

    Hi @pvdn ,

    why aren't all the config options implemented in the API?

    Good question. It's because APEX is committed to offer features that are supported by most browsers. Currently the image attribute is only supported in Chrome/Edge, like many others.

    I suppose a generic “options” parameter could allow you to build the options yourself.

  • castrogeneris OP 12 months ago

    Hi @vincent morneau ,

    I come accross to the same need of sending images here. So, with the generic “options”, do you mean they exists or you are asking if that would be a possible solution?

    Thank You.

  • vincent morneau Admin OP 12 months ago

    There is no generic options parameter currently. Will discuss with the team shortly.

  • castrogeneris OP 12 months ago

    Thank You!

  • vincent morneau Admin OP 11 months ago

    While I think there is value to this idea, I think it will be difficult to prioritize push notifications options that have partial support from browsers.

    There is an alternative you can try, which is to use a custom service worker hook for your push notification:

    Go to PWA edit page, then Service Worker Configuration, select Configure Hooks, then under push, select custom, then enter your customized notification code, such as

    const notification = event.data.json();
    self.registration.showNotification( notification.title, { ...notification, vibrate: [200, 100, 200, 100, 200, 100, 200] } );
    

    As browsers get new standardized options, APEX should make sure to support them declaratively.