Draft a Text Message for Later with Launch Center Pro 2.3

Tweet This Post

I've written a previous post on how to schedule a text message for later with Due and Launch Center Pro. However, now that LCP's encoding grammar has simplified, I'd like to revisit the topic. First off, an action to save a text in Drafts:

drafts://x-callback-url/create?text={{launch://messaging?to=8005551212&body=[prompt]}}

Click on this link to import it onto your iOS device.

Tap on the action, enter your text message, and an encoded launch://messaging URL scheme is saved in Drafts. When you are ready to send the text message, just make links clickable and tap on the URL scheme. It will open the text message in Messages to the designated recipient (change 8005551212 to his or her cell number).

The Contact Picker

LCP now has a contact picker -- [contact] -- that will allow you to choose a contact when you start the action. I tried creating the action above by substituting the phone number with [contact] -- the action can be imported here -- but it does not work.

drafts://x-callback-url/create?text={{launch://messaging?to=[contact]&body=[prompt]}}

The problem is that the body text is not encoded, so you get something like this:

 

Screenshot by @tahewett

 

I could not figure out how to fix this, so I wrote a pretty complicated action that does do the job. (Import it here).

launch://x-callback-url/clipboard?text=[contact]&x-success={{texttool://x-callback-url/transform?text=[prompt:your message]&method=encode&clipboard=0&x-success={{drafts:///create?text={{launch://messaging?to=||clipboard||&body=[[output]]}}}}}}

How It Works

First, the action asks you to pick a contact, and the number you choose is saved to the clipboard.

Then the action prompts you to enter your message. TextTool url-encodes your message, but does not save it to the clipboard (because we need the clipboard for the contact's number).

Then the action tells Drafts to create a new draft, the launch://messaging action. The body of the message is the [output] value carried from TextTool, and the to field is the clipboard contents, which -- because it has carried over two different x-successes -- needs to use ||clipboard|| to work, as explained here:

/create URL scheme now supports a special “||clipboard||” tag within the text parameter, which will substitute the contents of the clipboard at the time the “create” URL is opened. This can be used in an x-success callback URL to allow capture of a clipboard value that changed before returning to Drafts. Note the pipe characters, not brackets. This tag is not evaluated other time, only on /create URLs when processed by Drafts.


Last built: Thu, Jun 19, 2014 at 12:03 PM

By Jeffrey Kishner, Thursday, June 19, 2014 at 11:35 AM.