在每天使用node.js上在特定时间发送whatsapp上的消息时发出问题
我正在node.js上编写一个程序,该程序每天在特定时间发送WhatsApp模板。我使用了Node-Cron和SetInterval。当我在 https://id.heroku.com/login 要远程运行它不起作用。但是,当我在vscode上本地运行它时,它可以正常运行,我似乎无法弄清楚这个问题。
帮助您表示赞赏。
const express = require('express');
const webApp = express();
webApp.use(express.json());
const PORT = process.env.PORT;
function myFunc() {
// console.log("Checking every 2 second")
cron.schedule('15 16 * * *', () => {
console.log("Checking every 2 second")
sendDayTemplate();
})
}
setTimeout(myFunc, 1000);
webApp.listen(PORT, () => {
console.log(`Server is up and running at ${PORT}`);
});
I'm writing a program in Node.js which sends a WhatsApp template every day at a specific time. I used node-cron and setInterval. When I deployed the program on https://dashboard.render.com/# or https://id.heroku.com/login to run it remotely it doesn't work. but when I run it locally on VSCode it works fine, I can't seem to figure out the issue.
Help is appreciated.
const express = require('express');
const webApp = express();
webApp.use(express.json());
const PORT = process.env.PORT;
function myFunc() {
// console.log("Checking every 2 second")
cron.schedule('15 16 * * *', () => {
console.log("Checking every 2 second")
sendDayTemplate();
})
}
setTimeout(myFunc, 1000);
webApp.listen(PORT, () => {
console.log(`Server is up and running at ${PORT}`);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论