Make scheduled updates with API

Hi all,

I haven’t found anything on this topic in documentation so I decided to ask here, just to be sure.

I’m going to update my indexes using JavaScript API. So when I browse my specific page in browser it calls Algolia’s API and updates values. But the problem is that I don’t want to open my page in browser each time I need an update. Also, I don’t want to use any external scheduler, like windows service, etc. that will call my URL (just to not rely on those schedulers).

Question: is there any way to make Algolia call my URL (update data) each, lets say 30min?

Thanks in advance!

Usually, for such a use-case, you want to convert the script you’re using inside a webpage into a standalone script, i.e. a standalone my_script.js file that can be run with node.js, and run it periodically using a scheduler, like cron on Linux machines.

Here’s the (fairly) simple process I’d recommend you to do.

First, convert your page into a standalone script that you can run with node my_script.js.
Once you’ve managed to do this, you could create a really basic package.json with npm init, and add there a small script to run your file:

  "name": "my_project",
  "version": "1.0.0",
  "scripts": {
    "update": "node my_script.js"

Then, finally, I would use Heroku, where I’d push my script and package.json. Heroku is smart enough to detect its a node project based on the presence of a package.json, so whenever you push you’d have a node setup. Then with the Heroku scheduler add-on, I would set npm run update to run every 10 minutes, or every hour.

Yes, but the problem is that we use our CMS as a SAAS solution, so we don’t have any access to servers, etc. As a result I can’t install node.js, schedule any tasks, etc.