I've been playing with the Workflow.is App recently, and this one is pretty cool - using Workflow to scan and generate a QR Code with Contact information.

A QR Code (Quick Response Code) is like a two-dimensional barcode and is recognizable by black dots arranged in a grid with three corners having distinctive marker squares. QR Codes can represent all sorts of data - text, vCard, URL, location, etc. Try all this at goQR.me QR Code Generator.

Contacts are shared as in vCard format for electronic business cards. Read about the vCard format on Wikipedia, as I use the raw version 3 format in the code below (it's pretty straightforward).

Create a New Workflow

First create a new Workflow and add Choose from Menu with two menu items - Scan QR vCard and Generate my QR vCard.

Workflow Choose From Menu

Read vCard from a QR Code and Create a New Contact

This section uses the camera to read a QR code, and once it is detected, to automatically open the Contacts app allowing you to Save it.

Workflow Scan QR Code

In Scan QR vCard:

  1. Add Scan QR/Bar Code - totally automatic scanning, closes the camera once a QR code has been read.
  2. Add Get Text From Input - converts the "Bar code" type into text, i.e. the text vCard.
  3. Add Get File of Type = public.vcard - this is a magic identifier, called a Uniform Type Identifier (UTI), that tells iOS that the text is a vCard.
  4. And finally, add Open In..., disable Show Open In Menu and instead specify Contacts as the App - The vCard will be passed to the Contacts App, and you can either Save or Cancel it.

For brevity, this version does not validate that the QR Code contains a vCard. It could be any text, so it's best to add a quick check by with If Input Contains the Value BEGIN:VCARD.

I encountered instances where the Contacts app does not display the new Contact view, but displays the existing contacts list instead. I'm not sure what causes this and the only "fix" was to kill Contacts, after which the Workflow worked as expected.

Share your vCard via a QR Code

This section generates a QR code from a vCard and shows the QR code as an image. You can then save it, share it, or simply allow the recipient to scan it off your phone!

Workflow Generate QR Code

In Generate my QR vCard:

  1. Add a Text action containing the text BEGIN:VCARD... described next.
  2. Add Generate QR Code and leaving Error Correction as Medium.
  3. Finally, add Quick Look - this displays the QR code image.

The vCard is just plain text with a pre-defined format. Replace the text in brackets [[ ]] with your information. I prefer using static text, rather than being forced to share my real Contact since I don't bother to maintain it with my office address, and also have all sorts of other information there!

BEGIN:VCARD
VERSION:3.0
N:[[my last name]];[[my first name]];;[[salutation like Dr.]];
ORG:[[my company]]
TITLE:[[my job title]]
EMAIL;type=INTERNET;type=WORK:[[my @email]]
TEL;type=WORK;type=VOICE:[[my office phone]]
TEL;type=CELL;type=VOICE:[[my mobile]]
ADR;type=WORK:;;[[my office address];[[state]];[[city]];[[postcode]];[[country]]
END:VCARD

Share a Contact via a QR Code

It is also possible to share all a Contact's details. As mentioned, I don't like this method because it's not easy to filter what to share. If you want to try, here are the actions required.

  1. Add Select Contact.
  2. Add Get File of Type where Type = public.vcard.
  3. Add Set Name where Name is Contact.txt or the Contact Magic Variable followed by .txt - this step is required, does not work without!
  4. Add Generate QR Code.
  5. Finally, Quick Look.

Conclusion

Quite easy and fun. But honestly, the utility of QR codes for sharing Contact details is questionable - you could easily send your vCard via e-mail, iMessage or WhatsApp instead. QR codes are more useful when printed on business cards, handbills or posters.

Share Contact actions are based on QR Code from Contact on Workflow.is though not the focus of this post.