How to write a conditional Gmail add-on trigger?

90 Views Asked by At

I would like the addon to reload only when a new thread is selected, instead of reloading for every different message.

"contextualTriggers": [{
  "unconditional": {
  },
  "onTriggerFunction": "buildAddOn"
}]
1

There are 1 best solutions below

1
Amit Agarwal On

You can use CacheService to track the ID of the current Gmail thread inside the buildAddon method. If the thread Id changes, call the main method else skip.