Google Calendar API not working, but channel created

I am trying to listen to calendar events ( google-apps / calendar / v3 / reference / events / watch ).

I did everything from the Google console, the domains are OK, everything is checked, and I managed to create a channel. I also managed to get the sync message with the correct headers (see below). From the docs:

Sync Message

After creating a new notification channel to view the calendar API resource, Google sends a synchronization message to indicate that notifications are starting. The X-Goog-Resource-State HTTP header value for these messages is synchronized. Due to network synchronization problems, you can receive a synchronization message even before you receive a response from the clock method.

This means that notifications are starting

However, when I change something in the snaggs@comp.com account, nothing happens, the request does not send a callback : 'https://dev-api.mycompany/google-watch/'

This is my working code:

 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; } }); 

When I run the above code snippets, I get the answer:

 { "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" } 

And in the URL 'https://dev-api.mycompany/google-watch/' I get a sync message regarding documents, for example ( 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" } 

but no message exists

Did I miss something?

please, help,

+1
source share
1 answer

We used Push notifications for several years and noticed that over the past 24 hours we have not received any notifications on several thousand calendars.

Like you, we can create / stop the channel, but no changes are made to the changes.

About an hour ago, we get them again. Try your channel again, as this may be a failure on the Google Push side of the things that have been resolved.

+2
source

Source: https://habr.com/ru/post/1241664/