[英]How to send firebase cloud messaging notification based on user property user?
Like it's said here I know it's not possible to send notification by user property with the HTTP v1 API. 就像这里所说的,我知道不可能使用HTTP v1 API通过用户属性发送通知。
But is it possible to use an alternative way to do this? 但是是否可以使用其他方式来做到这一点? Like, call a cloud function from my backend that takes the message and the user property in parameter and send the notification.
就像,从我的后端调用一个cloud函数,该函数将消息和user属性作为参数并发送通知。
Have a look at the official Firebase sample which "demonstrates how to send a Firebase Cloud Messaging (FCM) notification from a Realtime Database triggered Function". 看一下Firebase的官方示例,该示例“演示如何从实时数据库触发的功能发送Firebase云消息(FCM)通知”。
Users sign into the app and are requested to enable notifications on their browsers.
用户登录该应用程序,并被要求在其浏览器上启用通知。 If they successfully enable notifications the device token is saved into the Realtime Database.
如果他们成功启用了通知,则设备令牌将保存到实时数据库中。
..... .....
The sample also features a Web UI to experience the FCM notification.
该示例还具有一个Web UI,以体验FCM通知。
All the code and instructions are here: https://github.com/firebase/functions-samples/tree/Node-8/fcm-notifications 所有代码和说明都在这里: https : //github.com/firebase/functions-samples/tree/Node-8/fcm-notifications
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.