What would be the recommended way to sync all events inside an end users calendar with my application?
By utilising Push Notifications, Read Events, and regular weekly syncs you will be certain that all events are pushed across from the Calendar Provider to your application.
Best Practice #
Here are the best practice to keep your application up to date with an end users calendar after the initial sync has processed:
- Set up a Push Notifications channel using the
calendar_id
you wish to sync. - When a notification is triggered, run a Read Events call on the
calendar_id
to poll for the changes made that triggered the notification. You can use thelast_modified
parameter to only return events that have been changed since the push notification was triggered. - Run regular syncs to catch any events that the Push Notification feature might miss due to being created outside of the sync window (see below)
Events Created Outside the Sync Window #
Cronofy utilises a sync window on all calendars which by default starts 42 days in the past and ends 201 days into the future. In order to not overload the notification channel it won’t trigger a push notification when event become visible because the sync window moved. This means that the event will not get synced unless you schedule regular polling of the calendar to catch any events that have snuck in.
You can set up a manual Read Events towards the end of the sync window to catch those events far in advance.
We also recommend that you run a weekly or daily sync by performing a read events call for all events for the calendar. While the above steps will ensure complete coverage, we recommend this occasional full sync for robustness.