Syncing your Brewster contacts to your iPhone Address Book with CardDAV

As a communication tool, Brewster does a lot of heavy lifting to help you find the best way to get in touch with someone. We sync data from multiple services (like your iPhone Address Book and social sites like Facebook and LinkedIn), combine phone numbers and email addresses into a single profile, and keep that contact information up-to-date. And it’s easy to initiate a call or text from within the app by simply pressing the associated button from within a contact’s profile.

But what about all the other apps on your phone? We realized how incredible it would be to have your Brewster contacts, de-duped and with their up-to-date information (including a beautiful high-res photo for each contact) available in Phone, Messages, Mail, and even third-party apps. We wanted to make this functionality simple to enable and guarantee that we never overwrite or even modify existing contact information. We’ve been working hard to improve this feature, called Contact Sync, and we’re excited to start publicizing it with last week’s App Store update.

Here’s what a Brewster-enhanced contact looks like in iOS 7:


So, how did we do it? We investigated a few different avenues — one of which was to simply write information directly into the iOS Contacts app — but that would involve directly modifying, adding, and deleting the existing records in the user’s address book database itself, creating the potential for duplicates and data-loss. In addition, we could only update the contacts when you ran the Brewster app itself, introducing the risk for contact information to become outdated. We ultimately settled upon the open IETF protocol CardDAV. Built off of the WebDAV and HTTP protocols, CardDAV implements support for client/server transmission of contact information using the vCard format. The benefits for us were clear:

  • Tight iOS integration. When you add a new CardDAV account, contacts in the account become accessible through the Phone, Messages and Mail search tools. You can toggle to set CardDAV as the default account in the “Groups” section of the Contacts app, making only those contacts available when scanning your iPhone address book. And, as an added bonus, photos for your Brewster contacts display full-screen when they call.
  • Non-destructive. While other methods we explored had the potential to alter your iPhone address book in harmful ways, adding or removing the contact information associated with a CardDAV account is simple and doesn’t interfere with any other contacts you may have on your phone.
  • Automatic Updates. Because CardDAV is a client/server protocol, any changes made to your contacts in Brewster are automatically synced down to your phone.
  • Simple to Set Up. iOS provides the ability to download configuration profiles in order to change settings on a phone — one of which is to add a CardDAV account. This allows us to set up a users’ CardDAV account in just a few steps, minimizing the friction that would result from having the user do so manually (entering a server address, username and password), as well as providing extra security.
  • An Open Standard. While the CardDAV protocol is fairly new — and not many clients support it — it made sense to hop on the bandwagon of a technology that will no doubt continue to advance and be integrated into more platforms well into the future.

We built our CardDAV implementation on top of our existing Rails app; this allowed us to reuse a lot of the existing work we had done to serve up data to the iPhone app. For example, a user’s contacts are retrieved from ElasticSearch using Elastictastic, our object-document mapper and API. Most of the new information we need to serve to the iPhone CardDAV client — including which contacts’ data in a user’s account has changed since their last sync — are stored in Cassandra and retrieved with Cequel, our CQL query builder and object-row mapper. Images are served up just as they are in our iPhone app, using our real-time image processor/host, Imagine. And we build the contact cards for CardDAV using our Ruby vCard builder/parser, vCardMate.

We’re thrilled with the way Contact Sync has come together in the new version of Brewster – it’s a one-tap feature that provides beautiful pictures for your contacts, all their latest contact info, and a quick way back to the Brewster app. And best of all, it doesn’t involve any risk to your local contacts – it can only make your address book better. Brewster is available for free on the App Store, and if CardDAV syncing and beautiful mobile apps are the kind of things you really care about, let us know.

Brewster Engineering Blog!

Brewster is an address book that understands your relationships and helps you stay in touch. The engineering team behind it works on a variety of complex problems from search to big data to mobile apps. Merging your contacts across different sources and rendering them into something appealing that you can search quickly is interesting and challenging, and we’ll use this blog to discuss our work in more detail.

We’re deeply committed to open source, and launched several projects recently at an event in NYC, where we’re based. The event was a big success, and the best thing about it was the quality of discourse brought by the attendees. It was a great reminder of the vibrancy of the tech community in the city, and we’re looking forward to more events like this.

In the coming weeks, we’ll post more about the open source projects we launched and talk about our use of Cassandra, Elasticsearch, and the other tools that make Brewster possible. Coming very soon is a post about CardDAV, a product launched last week that is one of my favorites.

Please let us know what you think in the comments and feel free to reach out anytime!

Randy Meech (