I am trying to create a time based trigger for a gmail add-on. Here is the sample code.
function myFunction()
{
// do something
// then create a time based trigger
ScriptApp.newTrigger("dummy_fun")
.timeBased()
.everyHours(12)
.create();
//return the card
}
function dummy_fun()
{
//do something
}
This is how my manifest file look like.
{
"timeZone": "America/Whitehorse",
"dependencies": {},
"oauthScopes": [
"https://www.googleapis.com/auth/gmail.addons.execute",
"https://www.googleapis.com/auth/gmail.addons.current.message.readonly",
"https://www.googleapis.com/auth/script.scriptapp"
],
"runtimeVersion": "V8",
"gmail": {
"name": "Time Trigger Test",
"logoUrl": "https://www.gstatic.com/images/icons/material/system/1x/receipt_black_24dp.png",
"contextualTriggers": [
{
"unconditional": {},
"onTriggerFunction": "myFunction"
}
]
}
}
Now the trigger is created when I press run button in the app script editor. But I get following exception every time when I open/refresh the add on in my gmail account.
Exception: Unexpected error while getting the method or property create on object ScriptApp.ClockTriggerBuilder. [line: 7, function: myFunction, file: Code]
Thanks.