How to send firebase notifications to audience via HTTP

落爺英雄遲暮 提交于 2019-11-27 08:30:13

firebaser here

There is currently no way to send a notification to a user segment programmatically. It can only be done from the Firebase Console as you've found.

We're aware that allowing this through an API would expand the potential for Firebase Notifications a lot. So we're considering adding it to the API. But as usual: no commitment and no timelines, since those tend to change as priorities shift.

This has been a popular request, but unfortunately it is not yet possible. We are looking into this. Please check Firebase Cloud Messaging announcements for any updates in the future.

You can try with topic subscriptions. It is not perfect solution but the best for me at this time.

{
  "to": "/topics/audience1_subscription"
  "data" : {
     "title" : "Sample title",
     "body" : "Sample body"
   },
 }
Aditya varale

Yes.There is trick with the "to" field as mentioned in below.

web URL is: https://fcm.googleapis.com/fcm/send

Content-Type: application/json

Authorization: key="YOUR_SEVER_KEY"

JSON DATA FORMAT:

{"to": "USER_FIREBASE_TOKEN",

"data": {"message": "This is a Firebase Cloud Messaging Topic Message",}

"notification": {"body": "This is firebase body",}}";
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!