Is this possible to emit a nodejs event when a Google calendar event is added or modified? On my nodejs server, I can get/list all the events on the calendar. But I would like to retrieve the events based on the nodejs event rather than checking it manually after a regular interval. Appreciate any ideas!
emitting a nodejs event when an event on google calendar is added or updated
733 views Asked by xMaster At
2
There are 2 answers
0
On
Actually, it is possible, as stated here: https://developers.google.com/google-apps/calendar/v3/push
You can register a callback URL so you app receives information when your event changes or gets modified. With the Node.JS API it's something like:
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);
});
Not possible. Something like that would require Google to know about your app (to send events or push data to). Google's APIs is only for meant to be accessed. It cannot "tell" your app anything. Your app has to be the one that "asks" Google whether or not something it wants exists or has happened.