2

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:

  1. 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();
  1. 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.

the below authorization screen

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).

Curious Explorer
  • 357
  • 2
  • 14
  • 1
    Nope. And I'm not sure that will even run - Gmail Add-ons are not allowed to use the simple or installable triggers (e.g. to configure a spreadsheet on edit, etc.), and while not mentioned, this may apply to time-based triggers as well. Review the restrictions page. – tehhowch Aug 22 '18 at 08:26
  • @tehhowch Thanks for the confirmation. Yes, I did give me an error. Exception: The recurrence interval for an Add-on trigger must be at least one hour – Curious Explorer Aug 22 '18 at 08:30

0 Answers0