Posting with Workflow


While waiting for the app to launch I thought I'd take a different approach with posting now that the site itself is largely sorted.

My main posting routine from Ulysses is largely set in stone, incorporating a mixture of Phoenix and Enlight for editing images but this is a bit overkill for microblogging. I also wanted to automate the selections specific to microblog posts.

I have considered purchasing the Workflow app for a while but never had a genuine use for it.

Until now!

Drafts is better suited to writing short, text only posts (including markdown syntax) so this was the starting point.

A workflow would need to automatically set the following:

  • post type to "Status"
  • category to "Microblog"
  • post status to "Published"

Because I use the Medium plugin I need to ensure that microblog posts will not get cross-posted. When publishing via an external source (e.g. Ulysses) the Medium plugin does not appear to be triggered but is when the post is edited and updated via WordPress itself.

I, therefore, need to be taken to the post editing page to turn this off before any accidents happen.

Building the flow

The first step is easy: use the Get Text from Input action to get the text from Drafts into the workflow. Thanks to tight integration between Drafts and Workflow your creation can be added directly to the Drafts actions list.

The text is then passed to the built in Post to WordPress action. After configuring it to connect to your blog you can pick the required options as listed above.

Once executed this action supplies the URL of the resultant post. As microblog posts are created without titles WordPress uses the post ID as the permalink. The post URL is saved to a variable so we can easily use it later. (In the latest version of Workflow, Magic Variables may serve this purpose but not, I found, in all cases.)

In order to navigate to the post edit page we have to construct the url based on the post ID. First, we need to isolate the post ID using Get Component of URL. This action pulls out specific sections of the URL such as:

  • scheme (e.g. http),
  • host (the root domain, e.g., and
  • path (the part of the URL after the host and before any queries)

The path component includes the post ID and, depending on the permalink structure, might look something like /2017/02/20/5941/ - 5941 here being the post ID.

Isolating the post ID requires us to use Split Text to divide the path into chunks using the / as the break points.

This generates a list of those chunks and Get Item from List easily lets us choose the last one (the post ID) and pass it to a new variable.

From here the quickest option is to use a Text action to manually type the full edit post URL and tag on the PostID variable created above. This would then just be launched using Open URLs.

Making it generic

Rather than typing in the full URL, which limits the workflow to one site, we could dynamically create it with repeated use of Get Component of URL to pull out the host (domain) and even the URL scheme to ensure it matches.

These components are then written to their own variables and used to build the full URL instead of being manually typed.

Removing Drafts

Drafts is good for making notes of things I might want to post later but if I wanted to post immediately and didn't need any Markdown I could remove Drafts from the process and replace it with the Ask for Input action.

The workflow can then be saved to the Homescreen as an app shortcut or added to the Workflow Today widget.

Learning curve

I'll admit that Workflow initially seems a bit daunting and there is definitely a learning curve to climb. There may, as always, be better ways of achieving the above.

However, having a clear idea of what you want to achieve, how this can be broken into simple steps, and taking some time to read the action descriptions makes it far easier.