HTTP v1 API: “click_action” for webpush notification

后端 未结 4 574
北海茫月
北海茫月 2021-01-23 16:42

Documentation in FCM focuses heavily on Android/iOS and my lowly webpush self is struggling with click_action.

click_action was a

相关标签:
4条回答
  • 2021-01-23 17:07

    Click_action works for me but I think it is not documented yet.

    I added it in webpush -> notification -> click_action.

    Edit : a new option is available in HTTP v1 API.

    0 讨论(0)
  • 2021-01-23 17:08

    Confirmed by multiple sources. click_action is not currently supported for WebPush in HTTP V1 on Firebase Cloud Messaging. Sad!

    0 讨论(0)
  • 2021-01-23 17:14

    Use your WebpushNotification.Builder object and call the putCustomData() method with click_action as the key and your click_action URL as the value.

    With the Java Firebase Admin SDK, it looks like this:

    wpnb.putCustomData("click_action", "<your_url_here>");
    
    0 讨论(0)
  • 2021-01-23 17:28

    You can include whatever key=>value pairs you want within the data field of your Web Push payload.

    Register a notificationclick event listener in your service worker and these data values are available within the event triggered when your notification is clicked. Access your data, then execute your desired click action.

    0 讨论(0)
提交回复
热议问题