Notification showing as JSON

Notifications are sometimes being shown as JSON itself in the notification drawer in my Android phone (and Windows desktop notification also). Looks like this is happening when the app is closed. When app is running the notification comes properly.

Also, in the garbled messages the icon is proper whereas in the proper messages just an initial is shown in place of icon. Attached images show the issue.

See how the message is proper but icon is not in this case.

Hi,

Usually this happens when there are multiple push vendors or Service Worker is installed.
How can I access your website to check if the issue is related to multiple Service Worker registration?

It is at https://app.aegir.in/

Google Workbox is used (was originally being used before integrating webpushr). Should I remove that altogether or there is a way to co-exist?

Better to remove it. Otherwise you have to import it into Webpushr’s service worker

if i remove it other features like caching would stop working

please guide me to any article you have about how to import it via Webpushr service worker

or, how to have features like caching enabled via Webpushr sw

Got it to work

self.addEventListener('push', function (e) {
var msg;
if (e.data) {
    var msg = JSON.parse(e.data.text());
} else {
    body = { t: "Aegir Alert", m: "" };
}

var options = {
    body: msg.m,
    title: msg.t,
    icon: "/img/icons/favicon-32x32.png",
    vibrate: [100, 50, 100],
    data: {
        dateOfArrival: Date.now()
    },
    ]
};
e.waitUntil(
    self.registration.showNotification(msg.t, options)
);
});