Я пытаюсь создать временной триггер для надстройки Gmail. Вот пример кода.
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
}
Вот так выглядит мой файл манифеста.
{
"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"
}
]
}
}
Теперь триггер создается, когда я нажимаю кнопку запуска в редакторе сценариев приложения. Но я получаю следующее исключение каждый раз, когда открываю / refre sh надстройку в моей учетной записи gmail.
Exception: Unexpected error while getting the method or property create on object ScriptApp.ClockTriggerBuilder. [line: 7, function: myFunction, file: Code]
Спасибо.