Reputation: 63
Hello good people of SO,
I'm using the Google Calendar API with node.js to register webhooks for push notifications related to events within a small window (about 24 hrs). My timeMin
and timeMax
parameters are not being respected, and my webhook is being hit with any changes to the calendars (in bounds and out of bounds).
I have tried including singleEvents : true
, removing ms from my timestamps, various timezone offset strings – Z
(ie .toISOString()
), +00:00
, and +0000
– and I am using only one-off events (no recurring events). I'm using valid OAuth tokens and not a service account. My request works fine otherwise and currently looks like this:
GCal.events.watch({
auth: _oa2Client,
calendarId : calID,
singleEvents : true,
timeMax : timeMax.toISOString().replace('Z', '+00:00'),
timeMin : timeMin.toISOString().replace('Z', '+00:00'),
resource : {
id : channelID,
type: 'web_hook',
address : config.google.CALENDAR_EVENTS_WEBHOOK_URL,
token: querystring.stringify(token),
expiration: timeMax.getTime()
}
}, callback);
and for the life of me I can't figure out what I'm doing wrong. Can anyone point me in the right direction? The solutions that have helped the similar events.list bounding problems have not helped here.
Upvotes: 1
Views: 597
Reputation: 287
One great way to figure out problems like this is to use the Google APIs Explorer interactively: https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.watch You can try out values for timeMin and timeMax and see their documentation.
The docs say to use an RFC3339 timestamp, which may not be the same as the ISO format you are using.
Upvotes: 1