【问题标题】:Schedule a notification at a specific time and date using firebase cloud messaging in NodeJs server使用 NodeJs 服务器中的 firebase 云消息在特定时间和日期安排通知
【发布时间】:2021-12-04 06:27:19
【问题描述】:

我已经使用 firebase 云消息在我的应用程序中成功实现了通知,并且能够使用 admin.messaging().sendToDevice(registrationToken, message, notify_options) 在节点服务器中的我的 API 中发送通知

我的问题是有没有办法安排在特定的时间和日期,例如圣诞节的 12 月 25 日。

【问题讨论】:

    标签: node.js firebase firebase-cloud-messaging


    【解决方案1】:

    有没有办法安排在特定的时间和日期

    是的,您可以使用scheduled Cloud Function。由于 Cloud Functions for Firebase 使用 Node.js Admin SDK,因此只需重用 Nodes.js 代码即可。

    您需要将用户 registrationTokens 保存在 Cloud Function 可以读取的存储空间中:我们通常使用 Firestore。

    云函数示例库中有一个example

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-13
      • 2017-10-15
      • 2021-05-10
      • 2016-07-30
      • 1970-01-01
      • 1970-01-01
      • 2016-12-09
      • 2021-11-02
      相关资源
      最近更新 更多