44: Project automation with Airmail, Workflow, and OmniFocus

Complex automation with email can be difficult, especially on iOS. Mail clients and services can provide the ability to create intricate rules, but typically their application is limited to moving, tagging, or otherwise organizing messages within a mail system. Heavy users of automation point to the conspicuous absence of the share sheet in Apple Mail. Fortunately, there are good third party mail alternatives on iOS. One of them, Airmail, offers multiple customizable actions, including access to the share sheet. Getting to the share sheet is really the magic step because it opens up access to action extensions from the Workflow app, making the data truly portable.

Airmail's sharing abilities plus the new URL parameters in OmniFocus 2.14 let me speed up a common work task. As part of my job I review content from freelance authors, and I get my review assignments by email. Each review has several required tasks that I've saved as a template project in OmniFocus. The old way was to copy the template project and manually fill in placeholders: assignment ID, author, and combinations of the two. It was quick, but manual. OmniFocus' new ability to accept the TaskPaper format meant that my project template, including contexts and due dates, can now be represented as plain text, and "plain" text in Workflow can also include variables.

Connecting the dots from there was relatively simple: extract the ID and author from the (generally) predictable email subject line with a regular expression. Pop those into the TaskPaper formatted project template. OmniFocus date math in the template gets parsed when the Workflow runs — these projects are to be completed within a week, so I just set a @due(1w) parameter. (More complex date math could be done with Workflow actions and an additional variable.) The whole assembled project gets copied to the clipboard and run with the new omnifocus:///paste trigger. Total it's four taps from incoming message to filled-out project: action menu in Airmail, Share, Run Workflow in the share sheet, and finally select the workflow itself.

It took about 30 minutes to put together this workflow (including pecking out regular expressions on the iPhone keyboard) and I'll likely run it 30 times before the end of the year, with about a one-minute savings each time. In the process I also learned the new OmniFocus text format and URL scheme, which is almost endlessly flexible. (One caveat is that new projects can't be auto-filed in folders yet, but Omni says that's coming soon.) I should also note that this workflow would be harder to set up on the Mac; it would probably require a mix of two or more scripting languages and a service to get it all working. This is my serious work — my livelihood — and thanks to these three apps, I'll be turning to iOS to do it faster than ever before.