iCal UID to De-duplicate events

Deduplicate Calendar Events with iCal UIDs

Learn how iCal UIDs work to enable events to sync seamlessly across calendars.

Ben Lloyd Pearson | February 12, 2020

We recently made iCalendar (iCal) UIDs available for most user accounts via the Nylas Calendar API, and the impact of this change is much larger than simply adding a new attribute to our Events endpoint (which allows developers to build apps that integrate with users’ calendar data from any provider). Let’s take a look at why this feature is important and how you can use it to sync events across multiple calendars. 

What is an iCal UID?

iCal is a standard for representing and exchanging calendaring and scheduling information such as events, to-dos, journal entries, and free/busy information, independent of specific calendar services or protocols. It’s supported by the vast majority of calendar clients and online calendaring services. RFC 5545 is the current standard, and it includes a definition for a UID property that provides a globally unique identifier that is set when the event is first created. Simply put, an iCal UID is a value that lets you identify unique calendar events across the vast majority of calendars in the world. 

How are iCal UIDs Structured?

To accomplish this, the official recommendation is to structure it similar to an email address with an @ symbol separating a system-level identifier on the left-hand side and a global identifier on the right. For example, [email protected]_server.com. However, while many companies follow this convention, there is no strict requirement, so it’s common to encounter calendar services that follow conventions of their own.
For example, here is what a typical UID from a Google account looks like:
[email protected]
And here is what it looks like for Office 365:
040000008200B00073D5B7101B82A00600000000239FD2D7
5307D402000000000000000010000000B6524FC3981F1B4CF
D31B3F9D2612722
Not to mention, providers also serve this value with different protocols. For example, Google provides this value as JSON, whereas Exchange Web Services provides it via XML. Fortunately, the Nylas Calendar API abstracts these differences away and makes it possible for you to access this value from all providers with the exact same integration. Let’s take a look at what you can do with an iCal UID.

Using iCal to Deduplicate Calendar Events

The biggest benefit iCal IDs provide is the ability to identify matching events across multiple user accounts, regardless of the calendar it currently exists on. In other words, it’s the best way to compare two events and determine if they are a copy of each other. 

Let’s think about a hypothetical situation where Bob and Alice want to keep track of certain meetings from their personal calendars on a shared calendar. The problem is that Bob uses Microsoft Outlook and Alice uses Gmail. So, if their friend Charlie (who uses Office 365) sends both of them an invite to the same event and they want that event to show up on the shared calendar, without the iCal UID it could be fairly difficult to identify whether the events on Bob and Alice’s calendars are duplicates. You’d have to do complex matching based on the event title, participants, date, etc. and each of these could be modified individually by the user or the provider, making this task even more difficult.

iCal UIDs are set by the calendar service provider when events are created, and this value remains the same even if it gets added to a calendar from a different service provider. So, in our example above, Office 365 would set the iCal UID when Charlie creates the event, and this value would match the respective values on the calendars of both Bob and Alice. 

This is different than the typical id that these, and most other, providers offer, which is used to identify events only within the provider itself; this value doesn’t have meaning outside the system on which the event exists. To complicate things further, some providers also make ids user-specific, so you can’t even rely on them to identify duplicate events across multiple users on the same provider.

Build Calendar Sync With iCal UIDs in 15 Minutes

Nylas is a Communications Platform that provides APIs for email, calendar, and contacts, and we’re the quickest way to integrate full calendar functionality into your app from 100% of providers. In as little as 15 minutes you can build your first integration that leverages iCal UIDs, or any other calendaring functionality you want to provide to your users, all while letting them use the third-party providers they prefer. Head over to our Getting Started page to learn more.

About the Author

Ben is the Developer Advocate for Nylas. He is a triathlete, musician, avid gamer, and loves to seek out the best breakfast tacos in Austin, Texas.

Ready to Start Building?