Create a Drafts 5 URL for a specific action

I just wrote a shortcut that some of you might find useful.

Suppose you want to embed a link that when clicked on will run a Drafts 5 action. I’m thinking of a Markdown link, or a HTML link, or even a raw link.

And suppose there are a few that you would regularly want to embed that way. (But occasionally another one occurs to you.)

This action enables you to do it.

Before you use it you will want to edit the list of action names at the top of the shortcut. I’ve only put one in.

  1. When you launch this shortcut - and I’ve set it up to respond to spoken “Drafts action” - it will pop up your (tailored) list of Drafts actions.

  2. Pick a Drafts action or select “Other…”.

    • If you select “Other…” you can enter an action name.
  3. Next you have the choice of three formats. Pick one and the link, together with the human-readable action name, will be copied to the clipboard. The formats are:

    • Markdown
    • HTML
    • URL only
  4. You are prompted as to whether you want to test the link - by immediately running it.

Action names can contain spaces; The URL encoding step enables that.

Here is a sample Markdown version of the link - copied straight out of the action:

[Test action with spaces](drafts5://x-callback-url/runAction?action=Test%20action%20with%20spaces)

And here’s an HTML one:

<a href='drafts5://x-callback-url/runAction?action=Test%20action%20with%20spaces'>Test action with spaces</a>

Why Bother?

The idea for this came out of trying to use a iThoughts mindmap as a launcher for actions. The Markdown produced by this shortcut works fine with it.

But then I tested it with Launch Center Pro, MindNode and Omnifocus.

The latter particularly interested me as a task like “write blah document in this specific format” could have a note where tapping on the link ran a Drafts action that created the document in that specific format. It could even prompt for input.

I haven’t figured out how to parameterise this, by the way.

Thoughts?

I should’ve added I can see the NFC support in Launch Center Pro as being useful to pop up a palette of “create document” actions, for example.

I tested this yet another way:

  1. I pasted a raw URL, made with this shortcut, into Qrafter QR code reader and made it send a QR code containing the URL to the iPad.

  2. Qrafter then read the barcode off the iPad’s screen and offered to open the URL. This worked nicely.

So I could create a scrap of paper with QR codes on - as a crude launcher of Drafts actions.