Auto-posting to WordPress (and archiving in Dropbox) with Drafts.

Last week at WWDC, I was lucky enough to spend some time with my friend Manton Reece talking about writing. He shared with me that he had a great little setup for posting short content to his WordPress site using IFTTT’s Do Note app and a plugin. He uses a customized version of the “status” format in WP to insert these smaller thoughts and then builds a separate RSS feed that you can optionally subscribe to in addition to the longer articles.

I thought I might like to do something like this, but after looking into it further, didn’t feel like tinkering with the post format, and figured I could probably get by with the standard format. But since every post I write starts as/is stored as Markdown in Dropbox, I was unable to automate the WP integration the way he had and still generate a local copy for myself. So I began thinking through this with one of my favorite apps, Drafts. What I was able to put together was a multi-step action that allows me to do exactly what I want with almost no effort.

Drafts allows you to send email as an action. WordPress allows you to post into the system via email. Using a combination of the action and the Jetpack plugin’s email functionality, I can go from idea to published in seconds, without touching the WP iOS app (which continues to get better, but still isn’t fast) and get my local copy stored away.

Let’s say I have an idea for something longer than a tweet, but shorter than my usual posts, and I want to just throw it up on the site. I open Drafts and write a short post where the first line is the title, and the remainder is the body. I run my “Quick Post” action which does the following:

  • Prompts me to pick 1-2 categories for the post
  • Launches an email sheet to allow me to proofread the post before sending
  • Using syntax provided in Jetpack, the post is published
  • Creates an archival .md file in the directory in Dropbox where my posts are stored

This could be sped up even further if I trust that I wrote everything correctly and skip the “foreground” email option to send in the background. However, the other benefit to having the draft email come up is the ability to edit any of the syntax on the fly if I decide to change something at the last minute. You also have the ability to simply create drafts of posts instead of auto-publishing by changing the post status option from “[status publish]” to [status draft]”. I’ve built this into a separate action so I have the ability to do either one quickly, if I’m not quite ready to put something live.

You’ll need to enable email posts on your WP site first, and generate the incoming email address to use in the Drafts action, so make sure it’s enabled and entered correctly. I also wanted to have the ability to add that second category prompt but back out without canceling the entire operation, so I asked Greg about it and he mentioned that if you turn off the “Include cancel button” option and create a button that just says “Cancel”, you can skip that step without stopping the whole action. This does create a tiny bit of editing that needs to be done, because you then have as category slugs something that looks like “[category apple,cancel]” but it adds a little flexibility and I’m willing to accept that tradeoff in that final step, since I’m proofreading (and potentially editing slightly) anyway before posting. But, since Greg is awesome, he added a scripting step to the action, which obviates the need to do this. Also, I only use categories, so you can add a step for tags if that’s more your flavor (see the Jetpack page for more info).

If you’re interested, I’ve posted the sample action (minus my WordPress-specific details) to the Drafts Action Directory here. After posting, on the web it displays the CC and BCC lines as filled with the same sample email address, but when the action is installed, they should be blank (correctly).

I really like writing in Markdown, and having a copy of all my posts easily accessible that I can return to outside of WordPress. And I’ve been looking for a way to write more frequently without committing to huge ideas. This series of steps achieves that in a quick and easy way, and I’m looking forward to seeing how it works for me.

Author: Seth Clifford

I'm here for the open bar.