Adam Garrett-Harris

Send Highlights From Goodlinks to Readwise

March 24, 2021

If you use GoodLinks for reading articles and you use Readwise for saving and remembering highlights from books/articles, you’ll love this. I made a custom GoodLinks action and a shortcut that work together to send highlights to Readwise. If you want to use it, skip down to the part on “Using the Shortcut”.

The custom action in action

Motivation

Some podcasters I listen to have been rethinking their RSS/Read-It-Later situation recently, including David Sparks and Federico Viticci.

For me, I love GoodLinks, but I want to be able to send highlights to Readwise. That’s why I switched to Instapaper and even started paying for it for it so that I could make more than 3 highlights per article and make unlimited notes (like I mentioned in my 2021 State of the Apps). But I would rather use GoodLinks if I can.

Technical Details

I read about GoodLinks custom actions in the MacStories review and wondered if I could build something to send highlights to Readwise from GoodLinks. And it is possible with the Readwise API and Shortcuts. To create a highlight with the API, you can’t use a GET request. You have to send a POST request. So I couldn’t just add a Readwise URL as my GoodLink action, which is probably for the best anyway, because now, using an x-callback-url, it brings you back to GoodLinks when it’s done.

GoodLinks provides data that you can pass along in the URL like title, author, and url. With the Shortcuts URL, you can pass a single piece of text. If all the shortcut needed was the title, the URL would look like this (anything wrapped in {} is URL encoded).

shortcuts://run-shortcut?name={Send Clipboard to Readwise}&input=text&text={[title]}

To pass along the title, author, and URL, I decided to use JSON.

{ "title": "{[title]}", "author": "{[author]}", "url": "[url]" }

I couldn’t use GoodLinks’ handy feature of wrapping it with {} to url encode it, because my text includes curly braces, so I did it manually, which ends up looking like this:

%7B%22title%22:%22{[title]}%22,%22author%22:%22{[author]}%22,%22url%22:%22[url]%22%7D

When you put that all together (and stick x-success=goodlinks:// on the end so that it will return to GoodLinks when it’s done) this is what it looks like.

shortcuts://run-shortcut?name={Send Clipboard to Readwise}&input=text&text=%7B%22title%22:%22{[title]}%22,%22author%22:%22{[author]}%22,%22url%22:%22[url]%22%7D&x-success=goodlinks://

Unfortunately, GoodLinks can’t tell you what text is highlighted, so you have to copy the text you want to highlight to the clipboard and then run the action.

Shortcuts, then URL decodes the input, and gets the contents of the clipboard, then it constructs a Dictionary and calls the Readwise API.

Using the Shortcut

  1. Get a Readwise account if you don’t already
  2. Get a Readwise access token (also known as an API key) here
  3. Add a custom action in GoodLinks
    • Tap the Gear icon
    • Tap “Custom Actions”
    • Tap the ”…” button
    • Tap “Add Action”
    • Under name, type/paste “Send Clipboard to Readwise”
    • Under URL, paste shortcuts://run-shortcut?name={Send Clipboard to Readwise}&input=text&text=%7B%22title%22:%22{[title]}%22,%22author%22:%22{[author]}%22,%22url%22:%22[url]%22%7D&x-success=goodlinks://
    • You can choose a color and an icon
  4. Install the Send Clipboard to Readwise shortcut
    • On your iPhone or iPad, open the link above
    • Tap “Get Shortcut”
    • Scroll to the bottom of the shortcut and tap “Add Untrusted Shortcut”
      • If this doesn’t work for you, you have to go to the settings app, scroll down to Shorcuts and turn on “Allow Untrusted Shortcuts”
    • Paste in your Readwise access token from step 2 and tap “Done”
  5. You’re all done, Phew! You can now use it by copying some text from an article you’re reading, tapping the ”…” at the bottom and tapping “Send Clipboard to Readwise”. It will open up Shortcuts briefly and take you right back to GoodLinks. Magic.

Written by Adam Garrett-Harris, host of BookBytes and Web of Tomorrow podcasts. You should follow him on Twitter