【问题标题】:Can't find out how to be notified when an event is beginning in Google Calendar?不知道如何在 Google 日历中开始活动时收到通知?
【发布时间】:2019-05-31 13:26:43
【问题描述】:

我正在考虑构建一个外部应用程序,该应用程序可以在 Google 日历活动开始或结束时执行操作。像 IFTT / Zapier 这样的服务似乎有这样的缺点,但我很难在 Google Calendar API 文档中看到他们在事件开始/结束时支持 webhook/通知,而不是主动不断地查询/存储即将发生的事件?

我已经查看了 Google 日历 API,但我没有看到说明如何在 Google 日历活动开始时通知我的 webhook/通知部分? https://developers.google.com/calendar/overview

【问题讨论】:

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


    【解决方案1】:

    如果您查看documentation,它会显示如何观看活动

    提出监视请求

    每个可观看的 Google 日历 API 资源在以下形式的 URI 处都有一个关联的 watch 方法:

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

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

    示例 开始观察给定日历上一系列事件的变化:

    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.
    }
    

    【讨论】:

    • 这并没有解决它,事件实际开始或结束时没有通知。我仍在为此苦苦挣扎。
    猜你喜欢
    • 2023-03-13
    • 2011-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-12
    • 2023-03-20
    相关资源
    最近更新 更多