无法找到在Google日历中开始活动时如何收到通知?

时间:2019-01-05 00:51:53

标签: push-notification google-api google-calendar-api

我正在考虑构建一个外部应用,该应用可以在Google日历事件开始或结束时执行操作。诸如IFTT / Zapier之类的服务似乎受到了打击,但是我正在努力查看事件开始/结束时它们在Google Calendar API文档中支持webhook / notifications的位置,而又没有积极不断地查询/存储即将发生的事件?

我已经查看过Google Calendar API,但是没有看到一个Webhook / notification部分,该部分说明如何在Google Calendar事件开始时得到通知? https://developers.google.com/calendar/overview

1 个答案:

答案 0 :(得分:0)

如果您选中documentation,它将显示如何观看事件

  

提出观看请求

     

每个可监视的Google Calendar API资源在以下格式的URI处都有一个关联的监视方法:

     

https://www.googleapis.com/apiName/apiVersion/resourcePath/watch   要为有关特定资源更改的消息设置通知通道,请将POST请求发送到资源的watch方法。

     

每个通知通道都与特定用户和特定资源(或资源集)相关联。除非当前用户拥有或有权访问该资源,否则监视请求将不会成功。

     

示例   开始查看给定日历上的一系列事件的更改:

POST https://www.googleapis.com/calendar/v3/calendars/my_calendar@gmail.com/events/watch
Authorization: Bearer auth_token_for_current_user
Content-Type: application/json

{
  "id": "01234567-89ab-cdef-0123456789ab", // Your channel ID.
  "type": "web_hook",
  "address": "https://mydomaina.com/notifications", // Your receiving URL.
  ...
  "token": "target=myApp-myCalendarChannelDest", // (Optional) Your channel token.
  "expiration": 1426325213000 // (Optional) Your requested channel expiration time.
}