Trigger script on Google calendar event
Asked Answered
L

2

7

I want to trigger some script when new calendar event is created in Google Calendar (say calling some rest API that enters event information to my database). I do not want any kind of UI that triggers the script.
Is it possible to achieve this using Google gadget since I do not want any UI? I would really appreciate the help as I am new to Google API.

Thanks a lot
Shubhra

Likelihood answered 23/1, 2014 at 7:28 Comment(0)
S
2

Calendar API has something like notifications. See this link: Push Notifications. From documentation:

The Google Calendar API provides push notifications that let you watch for changes to resources. You can use this feature to improve the performance of your application. It allows you to eliminate the extra network and compute costs involved with polling resources to determine if they have changed. Whenever a watched resource changes, the Google Calendar API notifies your application.

Shana answered 23/1, 2014 at 9:47 Comment(2)
I have gone through push notification documentation, But still having issue while request a watch on calendar events from python api. Would you help to achieve this using python api.Unwarrantable
The API only supports calling a URL when a calendar event is added or changed, not when one is due.Cammack
F
1

Google Calendar API (relevant docs) provides a watch endpoint that allows you to specify a webhook upon certain events.

To set up the webhook, you can call the Calendar API endpoint a POST request to https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch with the body

{
  "id": string
  "type": string,
  "address": string
}

The "address" field tells Calendar what endpoint to call when there is a new Calendar event. You'll need to create and host this endpoint yourself.

Another option is to use a service like Zapier, which has fantastic integrations for Google Calendar and makes setting up a listener (i.e. a trigger) and corresponding action very simple.

Fug answered 20/8, 2018 at 14:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.