How to trigger Google Script when a Google Task is marked “completed”

帅比萌擦擦* 提交于 2019-12-11 03:22:31

问题


Google Apps Script allows scripts to be triggered by a variety of events; see here.

I'd like to update the tag on an email (in Gmail) when the user marks a task completed (in Google Tasks) but there doesn't seem to be a trigger for this.

However, Zapier is able to trigger on these events somehow: supported triggers

So it seems like this trigger must exist.

Is there a way to do this other than using Zapier?

Unfortunately Zapier (in addition to costing money) only allows you to add tags to Gmail messages, not remove them -- so one can't (for instance) change a message tag from [uncompleted-task] to [completed-task].


回答1:


As of this writing (2018-05-15), Google Apps Script does not support a trigger to track a task's status.

I suspect that Zapier is polling the status of the task via the Task API; ie. periodically checking the status property of the task and firing an event once the status changes to complete.

You can do the same (with time-based triggers) using the Task API as an Advanced Service in GAS:

  • https://developers.google.com/apps-script/advanced/tasks
  • https://developers.google.com/tasks/quickstart/apps-script


来源:https://stackoverflow.com/questions/50360243/how-to-trigger-google-script-when-a-google-task-is-marked-completed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!