Google Calendar event Created/Updated/Deleted Webhook?
Asked Answered
B

3

11

I am developing a SPA webapp through which I add events to my users google calendar They have given permission for. However this is my first time using Google calendar API, and was unclear about how to retrieve my users existing events , or if they add new events or delete them. IS there an option to set a webhook within google calendar thus when the user makes any changes to the calendar I can receive the change. My current approach was to make multiple get requests but that seems very inefficient. How can I keep my app calendar in sync with all user created events.

Bradwell answered 3/2, 2017 at 10:38 Comment(0)
F
13

You can set up a push notification to be alerted any time anything changes on one of your calendars. I looked into it before a little, if memory serves it doesn't alert you to a lot of particularly useful information (I don't believe it tells you exactly what changed and how). Check out the docs here: https://developers.google.com/google-apps/calendar/v3/push

What I ended up doing was setting up a cronjob and getting all of my calendars' events using the synctoken, which returns only the events that have changed since the last time I polled the API for events. https://developers.google.com/google-apps/calendar/v3/sync

Fanny answered 3/2, 2017 at 14:30 Comment(3)
So there is no way to know , with the "push" system, which event has been "modified". what is the use of this push then ? :/Hypertension
That's true, with the Outlook Calendar APi, It does notify which resource has been modified but Google has to be different..Noellenoellyn
As far as I know, there's no watch API method for the calendar. I mean push notification doesn't support a calendar. But it has watch API for events. In this way, you can be aware of any changes to your created events not creating a new event on the calendar. According to the documentation: "Currently, the Google Calendar API supports notifications for changes to the Acl, CalendarList, Events, and Settings resources."Altigraph
C
1

If you are using the SyncToken in your request for data, all you get back is the events that have changed. There is an eventID in the Google records that you can use to connect the change to your event data.

Colchicum answered 2/7, 2019 at 10:32 Comment(0)
N
0

This google calendar API says that it sends webhook notifications when there are changes to Events: https://developers.google.com/calendar/api/v3/reference/events/watch

Notifications will be sent to an address you provide:

address string  The address where notifications are delivered for this channel.

Unfortunately, I'm not seeing any documentation of what the webhook notifications look like that are sent to your endpoint.

Neurotomy answered 13/7, 2023 at 20:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.