Automating short URL creation on iOS


 Drafts action


 Pythonista script

import urllib
import json
import webbrowser
import sys

url = sys.argv[1]
api = ''
token = 'Insert your token here'
request = api + '?access_token=' + token + '&longURL=' + url

usock = urllib.urlopen(request)
data =
dataJSON = json.loads(data)
shortURL = dataJSON["data"]["url"]

outputURL = 'drafts://x-callback-url/create?text=' + shortURL



If you do not have Pythonista this could be accomplished in a slightly less automated fashion using bitly’s x-callback-url scheme. When I looked into this I had no luck getting the x-success parameter to work though.

It is also worth noting that you must ensure your Pythonista script has the same name as the script you are calling in the first parameter of the Drafts action.


Special thanks to Federico Viticci and Alex Guyot for the inspiration.


Now read this

BookNet Canada Tech Forum 2014 Reading Recommendations

It’s Complicated: The Social Lives of Networked Teens Danah Boyd Creativity, Inc.: Overcoming the Unseen Forces That Stand in the Way of True Inspiration Ed Catmull Just Enough Research (A Book Apart #9) Erika Hall Smarter Than You... Continue →