Google calendar watch for updates on events - google-api

I want to listen programmatically when an event I created on the Google calendar is updated (like when someone accept/reject an invite) and I want to receive the relevant info regarding the event (type, confirmed/declined attendees, etc). I've tried using zapier and so far it does the job. Is there a native way to do that using Google API? I've also tried using Google calendar push notifications but the data I've received from the webhook isn't sufficient for my use case. Thanks!

You should be able to do this with a small Google Apps Script.
Their documentation explains the process of listening for a calendar change event. Then, you'll need to perform an incremental sync with the Calendar Sync API and handle the specifics of the event based on how you want.
Note that more simply, a webhook may suffice for your use case.

Related

Multiple organisers in google calendar event API

I am using the Google Calendar's event API. I have a unique requirements for creating a event is that for one particular event I need to make multiple organisers.
For example If there is an event E with attendees A1 and A2, then in A1's calendar he should be an organiser and A2's calendar he should be shown as organiser.
I am not able to find out how can I do this with API. There is one website in the market is doing the same as I mentioned but I could not able to find out how can I do this.
Could anyone please help me to find out this ??
From checking on the Google Calendar Web app it also appears that they do not allow more than one "Organizer" or "Owner" for the event so as DalmTo mentioned it might not be feasible either for the API. https://support.google.com/a/users/answer/9308863?hl=en#:~:text=If%20you%20own%20an%20event,event%20in%20your%20calendar%20grid.&text=Change%20owner.,message%20if%20you%20need%20to.

Play & App Store Webhooks / Server Side Code on subscription start and cancel

I need to add server side logic when a user buys and cancels a subscription. To me this seems like a basic feature that many apps probably use. However as it turns out it's not that simple to setup up the need webhooks.
My App will be available on android and iOS, so I will need to configure both, which is why I thought about using RevenueCat. But it turns out, this is a paid feature for $110/month, which is way too much for a/my new app. This is probably the biggest time saver for RevenueCat compared to using the official InApp Purchases packages, so I don't see why they would make it a paid feature.
Anyways what the best way to handle webhooks with the Play Store and the App Store? Any Guides and Tipps would be very helpful!
Apple and Google both offer server-to-server notifications that will notify you when a subscriber cancels.
Apple guide: Enabling Server-to-Server Notifications
Google guide: Real-time developer notifications
If you have your own user Ids, they won't be present in these server notifications so on your server you can save the user Id along with the transaction identifier of their original purchase. That way when a notification comes in you can look up the user from the transaction identifier and flag them as cancelled.
Alternatively, the RevenueCat API is included on their free plan so you can periodically poll their GET /subscribers endpoint to get the latest subscription status for a user. This obviously won't be real-time, but may be enough for your use-case.
Update: I decided to solve this issue similar as #enc_life suggested with the RevenueCat API. For validation the purchase, I send a request to my server, that checks with if the user actually bought the subscription. For canceling the subscription, I execute a function everyday on my server, that checks for all subscribers if the subscription is still valid.

Trigger PubSub messages on Google Sheets save actions

I am trying to automate a Google Sheet import as soon as someone has committed their changes to Google Sheet's version control (and not just edited any cell like the onEdit event seems to trigger, I need it committed).
While polling is an option, I'd rather really have Google Sheets send out a message to PubSub. Now PubSub requires the authentication JSON and such and I haven't seen any integration with Google Sheets that integrates this concept, which surprised me.
I searched on the internet for triggers in Google Sheet and some way to automate code to connect to external resources. Apparently, the Google Drive Push Notification API seems to be the way to go. I'd really like to keep everything in my Google Cloud space so I went for a Google Cloud Function with an HTTP(S) endpoint. I already started working out the Function and PubSub channel when I went back to the documentation to read up on how to send a call to the HTTP endpoint.
Bad luck. Seems you need to register the domain to prove you own it and wishing I could, I can not prove that I own cloudfunctions.net. So there went my plan.
It seems very not-Google like to not integrate its Cloud SDK on Google Sheets triggers since they do offer a Sheets API using Cloud Service Accounts.
So my conclusion is I have two options:
1) I am able to send an HTTP callback on a onEdit() function but only if it's my own domain and I seem to require to set up an environment just for that.
2) I would have to poll the last version of the Google Sheets commit compared to the latest version to trigger it myself.
Am I overlooking something very simple or are these my only options?
Cloud functions count as an AppEngine Standard Endpoint as described here and here, and so do not require domain verification. You can use a cloud function using a Cloud Pub/Sub trigger freely- you don't even need to explicitly set up a subscription.
Edit: I didn't understand the OPs question correctly, they want to prove their ownership of a cloud function to the Google Drive Push Notification API, not Cloud Pub/Sub push. This should be possible through HTML tag verification as described here. In whatever framework you are using for your web server, you should be able to set the appropriate HTML meta tag on the response.

Prevent conflicts when creating events in a resource calendar using Google Calendar V3

I'm trying to solve a problem of preventing double bookings using the Google Calendar Api (v3). I'm using Google resources in a GSuite environment. The bookings are made from a centralized platform on behalf of multiple users and are applied to multiple rooms (resources). The responsible application authenticates using a Service Account. The resource calendars are all configured to only accept invitations that do not conflict.
So far I found out that there are at least two ways to book a resource:
Create an event in the resource calendar
Create an event in a personal calendar en add the resource as attendee
I found out that in the first senario, events can be added to the resource calendar, even if they cause a conflict. There is no failure in the api response, the event is just added.
I tested the second scenario with my personal calendar and found out that the room needs to respond to the event invitation. Apparently that process may take several minutes before the room responds.
I'm building an api that should respond as fast as possible, but I want it to only create an event if it doesn't conflict. Of course I can use the free/busy information to reduce the chance of conclicts, but I would like to eliminate that chance entirely.
Does anyone know if Google provides functionality for this problem out of the box?
Thanks in advance.
Google does not do any validation on the api. You send what you want inserted and they insert it. Its up to you to ensure that it does not conflict with anything already there.
May i suggest that you check before you insert it and then do a double check in a few minutes to ensure there is no conflicts if there is then delete it again.

Disable email notificaton when sharing a Google Calendar

I am using the Google Calendar API V3 to share Google calendars by managing the ACL Permissions. Many of my customers do not want an email notification when a new calendar is shared with them. Is there a way to disable that?
To explain bette what I am looking for: I also use the Google drive API v2 and that API addresses the issue by providing a sendNotificationEmails parameter that you can set to False when sharing a Google document (see this). I am looking for something similar.
Based from this documentation, you need to set sendNotifications to false so invitee didn't get the notification about the invitation even though invitee's calendar UI has New events setting to "true".
Check this example.
I don't believe this is currently possible. Sharing a calendar involves adding an ACL for a given user/group, and the notification email is generated upon adding the ACL. There does not appear to be any way to suppress the notification email. Even if you could, if you are sharing with a group, the individual users must click a link to add the calendar to their Calendar app.
I have put in a group of feature requests through the Calendar forum that would make this process easier. While it is aimed at the front end of the calendar application, I'm hoping they would add corresponding options to the APIs.

Resources