xMaster
xMaster

Reputation: 33

emitting a nodejs event when an event on google calendar is added or updated

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!

Upvotes: 0

Views: 740

Answers (2)

danielapsmaior
danielapsmaior

Reputation: 162

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

    });

Upvotes: 1

laggingreflex
laggingreflex

Reputation: 34627

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.

Upvotes: 0

Related Questions