Dispatch text to Pastebin with 1Writer

I'm always looking for ways to help people with automation on iOS and when the Drafts Twitter account retweeted a plea, asking if anyone figured out a way to integrate Drafts and Pastebin – I couldn't contain myself. By the end of the day, I achieved the goal with 1Writer and I'll tell you why and how.

Javascript grew on me since I started working as a web designer 1 and I was even more motivated when Greg introduced a Javascript engine to Drafts 4, I even delayed my review until I finished my natural language parser for task managers. 1Writer added its own implementation afterwards, which I covered with actions to get App Store links.

Drafts 4 revamped the process to create actions with action steps you can stack up, therefore users could hit multiple destinations with a simple, easy to build, action since every step shares the same template tags, such as [[title]]. Still, steps like Javascript and the prompt can assemble new tags and this balance makes Drafts 4 a powerful and accessible tool.

For the moment Drafts is unable to call APIs using XMLHttpRequest()2, so I detoured from the original request and reached out for 1Writer for its extended methods, one of them dedicated to HTTP requests. I'm not reminded often enough how good 1Writer is.

You can download the action here and it requires some configuration. Due to API limitations, I can't share my developer token, so I'll tell you how to get yours. Just create a Pastebin account and go to this page. Copy that weird string and return to 1Writer, open the action3 and look for the line with INSERT API KEY HERE written in discreet all caps at the first line of the script; replace it with your API token and you're good to go.

The script is set to share publicly and expire documents after 10 minutes. Read the documentation to tweak the action, the pb_expire variable is responsible for the expiration date and pb_private handles public availability of your content.

If you're still adrift, ping me on Twitter and I'll help you out. Also, if you got an idea for an action and struggle to implement it, send it my way and we can work it out together.

  1. Or whatever people call themselves these days. I like the ring of web designer

  2. And I wouldn't be surprised if this assertion gets addressed soon. 

  3. Within any document, tap the ellipsis icon at the bottom left, find the Send to Pastebin action you just installed and tap the Get Info icon at the row's right edge.