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!
Asked
Active
Viewed 705 times
0
-
Can you show some code of how you get the events data? – Dejan Toteff Jun 19 '15 at 11:11
-
@Dejan you can check step 3 here: https://developers.google.com/google-apps/calendar/quickstart/nodejs – xMaster Jun 19 '15 at 14:22
2 Answers
1
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);
});

danielapsmaior
- 152
- 9
0
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.

laggingreflex
- 32,948
- 35
- 141
- 196