谷歌API日历手表不起作用,但渠道创build

我试着听我的日历更改事件( 谷歌应用程序/日历/ V3 /参考/事件/手表 )。

我做了一切从谷歌控制台端,域 – 好吧,一切都validation,我成功地创build频道。 此外,我成功地获得sync消息与正确的标题(见下文)。 从文档:

同步消息

创build新的通知频道以观看资源后,Google日历API会发送同步消息以指示通知正在启动。 这些消息的X-Goog-Resource-State HTTP标头值是同步的。 由于networking时间问题,即使在收到监视方法响应之前,也可能会收到同步消息。

这意味着notifications are starting

但是,当我改变了一些在snaggs@comp.com帐户 – 什么也没有发生,没有请求发送到callback'https://dev-api.mycompany/google-watch/'

这是我的工作代码:

 var google = require('googleapis'); var googleAuth = require('google-auth-library'); var _ = require('underscore-node'); var uuid = require('node-uuid'); // ...... var channel_id = uuid.v1(); _auth.credentials = { access_token: _token.access_token, token_type: _token.token_type, refresh_token: _token.refresh_token, expiry_date: _token.expiry_date }; var data = { auth: _auth, calendarId: _token.provider_email, singleEvents: true, orderBy: 'startTime', resource: { id: channel_id, token: 'email='+_token.provider_email, address: 'https://dev-api.mycompany/google-watch/', type: 'web_hook', params: { ttl: '36000' } } }; calendar.events.watch(data, function (err, response) { if (err) { console.error('The API returned an error: ' + err); return; } }); 

当我开始上面提到的代码片段,我得到的回应:

 { "kind": "api#channel", "id": "277fa000-d4b6-12e5-ab58-e7afaf85ea65", "resourceId": "C7vFL07CYfqaHy3vDss4qugWDfk", "resourceUri": "https://www.googleapis.com/calendar/v3/calendars/snaggs@comp.com/events?orderBy=START_TIME&singleEvents=true&alt=json", "token": "email=snaggs@comp.com", "expiration": "1455667451000" } 

'https://dev-api.mycompany/google-watch/'url中,我收到了关于文档的sync消息问题,例如(请参阅google-apps / calendar / v3 / push ):

 { "host": "dev-api.mycompany", "accept": "*/*", "accept-encoding": "gzip,deflate", "user-agent": "APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)", "x-goog-channel-expiration": "Tue, 16 Feb 2016 22:44:51 GMT", "x-goog-channel-id": "277fa000-d4b6-12e5-ab58-e7afaf85ea65", "x-goog-channel-token": "email=snaggs@comp.com", "x-goog-message-number": "1", "x-goog-resource-id": "C7vFL07CYfqaHy3vDss4qugWDfk", "x-goog-resource-state": "sync", "x-goog-resource-uri": "https://www.googleapis.com/calendar/v3/calendars/snaggs@comp.com/events?orderBy=START_TIME&singleEvents=true&alt=json", "x-forwarded-for": "56.102.7.132", "x-forwarded-port": "443", "x-forwarded-proto": "https", "content-length": "0", "connection": "keep-alive" } 

但不exists消息

我想念什么?

请帮忙,

我们一直使用推送通知几年,并注意到在过去的24小时内,我们没有收到任何通过数千日历的通知。

像你一样,我们可以创build/停止一个频道,但是没有收到任何通知。

大约一个小时之前,我们又收到了他们。 请再次尝试您的频道,因为这可能是已解决事情的Google Push方面的小故障。