Adding a 'link' option to web push via FCM
I'm using Firebase (FCM) provider to send push notifications to web browsers via Novu. I'm trying to set the
link
option so that clicking the notification takes the user back to the website.
I can get push notifications, title, body and images are working: but I can't seem to set the link property as per the interface here:
https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.webpushconfig
Looking at the docs / code, I expect that I should be able to send a payload like
I can see that other webPush
settings I'm setting such as imageUrl
work - but I can't seem to get the link value to come through. I've tried fcmOptions
and fcm_options
but neither seems to work. Does anyone have any experience getting this value across to the service worker?4 Replies
Hi @dmgarland
If above code is not working, try with data fields
Cracked it, posting for posterity:
You cannot use absolute URLs as the link parameter, but only relative URLs. This is very confusing as the Firebase docs stipulate using HTTPS and imply (so it seems to me) that therefore the whole URL is required ! The following worked for me
Thanks for sharing @dmgarland
We will update the info in docs