google-apigoogle-calendar-apigoogle-admin-sdkgoogle-api-python-client

How to detect the user on google calendar events push notification callback?


I am trying to sync a booking system with google calendar and google resource as two-way synchronization.

To do that, I creates webhook channels on specific google resource calendars to be aware of creating events (i.e. booking a resource room), updating, and deleting. It works fine — whenever a user creates an event out backend got notified by the google push notification and I can fetch the respective meeting room in our system as well for booking.

But the problem is, I cannot distinguish which user was that! According to the google push notification information I couldn't find any thing about the user information on the callback data. Is there any solution?

Data of header in callback notification:

Host: f73b-98-14-18-68.eu.ngrok.io
User-Agent: APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)
Content-Length: 0
Accept: */*
Accept-Encoding: gzip, deflate, br
X-Forwarded-For: 74.125.210.217
X-Forwarded-Proto: https
X-Goog-Channel-Expiration: Thu, 02 Mar 2023 06:34:05 GMT
X-Goog-Channel-Id: 12345678904
X-Goog-Message-Number: 6863357
X-Goog-Resource-Id: szg7mO63iJ_3oMLRGXyv7868CQQ
X-Goog-Resource-State: exists
X-Goog-Resource-Uri: https://www.googleapis.com/calendar/v3/calendars/c_1887qe9rpoms8hdanb029mmhoiira%40resource.calendar.google.com/events?alt=json

Google calendar events watch API
Receiving notification


Solution

  • The push notifications are meant to just be a low-throughput way to check for changes to the Calendar, so it only contains the ID of the channel and the calendar ID. Currently there's no way to get specific event info in the push notification.

    Your options are to combine the notifications with other APIs. For example:

    The bottom line is that the push notifications by themselves cannot tell you who made the change, since their job is just to notify you that something changed, but you have a few ways to get the info afterwards.