It's not trivial to deploy a cron scheduler on Google Cloud. Here I purpose a simple way to prototype it. Since most part of tasks will only need a basic frequency trigger the hourly / daily / weekly / monthly percision will suffice.
Just drop the appscript.gs code insdie a freshly created appscript project. Name the project with an easily recognizable name since Google Drive doesn't let you filter by appscript file type.
Make the appscript project trigger each function with the right frequency (i.e. trigger hourly()
each our).
Extra: if you don't want to receive emails on failed calls disable them on every trigger you add.
Choose an http trigger. Paste the index.js
file and the package.json
in the corresponding files.
Choose cron
as the function to trigger. Name the function the same way you choose in the appscript
(so that the url matches)
Create the for each named frequency named cron-<frequency>
, where frequency can be hourly / daily / weekly / monthly.
Now that you have topics that get hit with certain frequency you can deploy other cloud functions to be triggered