Reputation: 8653
I looked at the google calendar node js api and this wasn’t clear.
How do I set up a web hook using the Nodejs google calendar library?
I want to tell google to ping a server when my clients has either added or changed an appointment on his google calendar?
How can I use Nodejs to set up the watch?
Upvotes: 2
Views: 1373
Reputation: 1196
The Google Calendar API provides push notifications that let you watch for changes to resources (Webhooks).
Google Calendar Push notification | View in Fusebit |
---|
const calendar = googleClient.calendar('v3');
const watchResponse = await calendar.events.watch({
resource: {
id: uuidv4(),
type: 'web_hook',
address: 'Your webhook address here'
},
calendarId: 'primary'
});
const { data } = watchResponse;
console.log('Calendar Webhook created', data);
Upvotes: 2