0

添加或修改 Google 日历事件时,是否可以发出 nodejs 事件?在我的 nodejs 服务器上,我可以获取/列出日历上的所有事件。但我想根据 nodejs 事件检索事件,而不是在定期间隔后手动检查它。欣赏任何想法!

4

2 回答 2

1

实际上,有可能,如此处所述:https ://developers.google.com/google-apps/calendar/v3/push

您可以注册一个回调 URL,以便您的应用程序在您的事件更改或被修改时接收信息。使用 Node.JS API,它类似于:

  calendar.events.watch({

        auth:jwtClient,
        resource: {
            id: "yourChannelId",
            type: 'web_hook',
            address: "https://www.yoursite.com/notifications"
        },
        calendarId: "yourcalendarId"
    }, function(error, response) {
        if (error) {
            console.log(error);
            return;
        }
        console.log(response);

    });
于 2016-01-27T20:59:23.423 回答
0

不可能。类似的事情需要谷歌知道应用程序(发送事件或推送数据)。Google的API 仅供访问。它不能“告诉”您的应用程序任何事情。你的应用程序必须是“询问”谷歌它想要的东西是否存在或已经发生的应用程序。

于 2015-06-19T11:53:42.390 回答