Web Notifications - Customise icon, text and route

I am using the web push notifications API via CometChat.registerTokenForPushNotification(token)

This works well and gives me web notifications when not on the tab window. However, is there anyway we can customise the icon/text within the Notification as this is all handled by comet chat?

Also, we would like to change the location that the notification takes you upon click.

Hey @neeko

FCM allows you to send two types of messages:

  1. Notification message
  2. Data message.

More about it here.

The extension sends a Notification message by default for the Web platform.
You can choose to receive a Data message notification by NOT including the “notification” key in the message payload. You can set this from the Push Notification extension’s settings as shown below:

image

You have to then write a custom function in the service worker that will allow you to set the icon for the notification. You will have complete control over how the notification should be displayed.

Hope this helps.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.