'How to automate my first Telegram application?

I'm just learning the backend. I created my first application, all it does is get data -> publish it to a Telegram bot.

I want the application to work 24/7. But I don't know how to make it automated. I run it using terminal node main.js. How do I emit a command input to the terminal? (Importantly, it doesn't suit me to wrap everything in a function and call it).

I found that it can be done with node cron, but I don't know how to do it. As a result, I want to load my application on Heroku and have the node main.js command run using the task scheduler.

I want to get something like this:

 const scheduler = new ToadScheduler()
  const task = new Task('simple task', () => node main.js)
  const job = new SimpleIntervalJob({ seconds: 60, }, task)
  scheduler.addSimpleIntervalJob(


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source