Google Cloud Function Node.js Firebase Url

我有一个Android应用程序,我可以通过http格式从我的设备发送推送通知,但现在我想写一个节点,我希望在特定的date和时间安排推送通知,有人请帮助我,我是长期以来一直陷在这个过程中

这是我的节点;

const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeApp(functions.config().firebase); exports.sendNotification = functions.https.onRequest((req, res) => { const to = req.query.to; const title = req.query.title; const body = req.query.body; var payload; if (body != undefined && body !== '') { payload = { notification: { title: title, body: body } }; } else { payload = { notification: { title: title } }; } var options = { priority: "high", timeToLive: 60 * 60 * 24 }; if (to == 'all') { admin.messaging().sendToTopic(to, payload, options) .then(function (response) { res.send(200, 'ok'); }) .catch(function (error) { res.send(200, 'failed'); }); } else { admin.messaging().sendToDevice(to, payload, options) .then(function (response) { res.send(200, 'ok'); }) .catch(function (error) { res.send(200, 'failed'); }); } }); 

这里我在运行生成推送通知时有URL,

 https://MyProjectName.cloudfunctions.net/sendNotification?to=all&title=hello&body=EnterBodyHere 

现在,请帮我安排这个推送通知

本地主机:8080:/?schedulePush天= 17&月= 10小时= 12&分钟= 22

云function目前没有内置的调度机制。 如果您想在特定的时间执行某个function,则需要使用其他一些调度程序。 有一篇关于这方面的博客文章 ,以及讨论这个的代码示例 。