Editorial -> Tumblr

As you might have noticed from the little branded buttons at the top of the page, my blog runs on Tumblr.1 I’ve been using Byword and the official Tumblr iOS app to publish new posts, which has been working great.

Last night, though, I noticed a small hiccup. A post I made through the Tumblr iPad app didn’t auto-tweet the headline to my blog’s Twitter account. That’s a small problem, but my brain wouldn’t let it go.

So, after a bit of fiddling, I can now post to Tumblr directly from Editorial, and my headlines get syndicated properly to Twitter.2

Setting this up isn’t trivial, so if you want to use it, you’ll need to be comfortable with downloading scripts, working with the command line, screwing with API keys, and more. Also, this is only for creating text posts. Tumblr supports several other post types (photo, link, quote, etc.), but supporting those is outside the scope of this post.

Getting Tumblr API Access

First, you’ll need an OAuth key, which you can get by registering an application with Tumblr. Fill out the form and click Register. Here’s how I filled out mine; you can do something similar:

Form

Now that you have an OAuth consumer key and secret, you’ll need an access token. To get that, download this script (here’s a link to the raw text). Copy the text, and save it in a plain text file somewhere. Name it something like tumblr.py. Add your consumer key and consumer secret by replacing the values on lines 4 and 5.

consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'

Launch Terminal.app.3 Navigate to the directory where you saved the tumblr.py script. If you dropped it into your Downloads folder, then you would enter cd ~/Downloads and press Return. Now, type python tumblr.py and press Return. Follow the prompts on the screen; it will ask you to paste a URL into your browser. When you do, you’ll see a screen asking for access to your account. It will look like this:

Auth Screen

Click Allow. If you’re using Safari, you’ll see an error page. Don’t panic; that’s expected.

Go back to Terminal, type y, and press Return. You’ll be asked for the OAuth Verifier. Go back to Safari, and look at the URL. You’ll see a section that mentions oauth_verifier.

URL Bar

Select everything between the = and the # and copy it. Go back to Terminal, paste it in, and press Return. If you’ve completed these steps successfully, the script will spit out your access token and access secret. Huzzah!

Setting Up Editorial

Before you can use the Tumblr API through Editorial, you’ll need to install the official Tumblr Python client, PyTumblr. You can do so using this workflow, which I adapted from Ole Zorn’s workflow for installing Rackspace’s Cloudfiles client. Install the workflow and run it; you can delete the workflow after it runs.

Install the Post to Tumblr workflow in Editorial, then edit it. Tap the action titled Post it, and scroll the source code to line 7. Change the value of BLOG_NAME to your Tumblr blog’s address (if you’re using a custom domain, use the original .tumblr.com domain, not the domain you registered).

Replace the values on lines 17 through 20 with the consumer key, consumer secret, access key, and access secret you generated above.

Tap Done to save your changes.

Using the Workflow

When you run the workflow, you’ll be presented with a pop-up that asks for a title. It defaults to the file name of the current document. After entering a title, it’ll ask you for tags. You can leave this blank, or you can enter a comma-separated list.

Now go write something and stop fiddling with your text editor!


  1. For now.
  2. By “a bit of fiddling” I mean to say I was up until 1:30 after trying to walk away from making this work twice. Now I’m tired. Shut up.
  3. In case you’ve never seen it, it’s in the Utilities folder of your Applications folder.