In the Gmail addon, I am building I need to hit an external API every few minutes to check for a flag and then reload the addon.
The closest I can see is this : https://developers.google.com/apps-script/reference/script/clock-trigger-builder#everyminutesn
However, Even when I add this scope required for this :
This has the following problems:
- When I use the code below, I see: "Exception: The recurrence interval for an Add-on trigger must be at least one hour". <- this is a major blocker as I need to trigger every 2 mins or so.
I tried this code:
ScriptApp.newTrigger("getContextualAddon")
.timeBased()
.everyMinutes(1)
.create();
- Even if this works the permission: "Allow this application to run when you are not present" is rather scary for the users of my addon who think the addon will do something in the background.
Is there any other way I can achieve this. I tried normal setInterval but it of course fails as this is not plain javascript (and it runs on the server).