I’m working on a Google Apps Script that automatically adds third-party video meeting links to calendar appointments.
Right now I can manually run the script, but I want it to trigger automatically whenever someone books a meeting through Calendly that gets added to my Google Calendar.
My main questions are:
How do I set up an automatic trigger that fires when new events appear in my calendar?
Is there a way to tell if a calendar event came from Calendly specifically?
What’s the best approach to make sure I only process the Calendly bookings and not other events?
I’ve been looking at installable triggers but I’m not sure which one would work best for this use case. Any help would be great!
I’ve accomplished something similar using the installable Calendar trigger with onEventUpdated, which works effectively for this purpose. When a Calendly appointment is created or updated, it results in an event change that the trigger can recognize.
To identify events from Calendly, analyze the description and organizer fields; they often contain distinctive patterns and come from calendly.com domains. Additionally, the event source property can indicate external bookings.
It’s important to note that this trigger activates for all calendar changes, so implementing thorough filtering is crucial. Ensure that you check whether the event already has your custom properties to prevent processing duplicates. Adding a slight delay might be necessary, as it sometimes takes a moment for Calendly events to be fully processed after the trigger is activated. It’s beneficial to test with actual Calendly bookings as the event structure may vary based on your configurations.