Script | Copy an item-link (x-devonthink-item://) by shortcut and automatically short it by TinyURL

Hello.

Notion and other web-apps doesn’t support links like (x-devonthink-item://, dayone://), so it isn’t possible to add them for example in Notion. I find another way to do it (TinyURL for example), but it is not a good workflow for me - copy an dt item-link and everytime paste it https://tinyurl.com/. I need a script which would do that automatically, or it would be very nice if DT could implement it in DT by an update later - because than it would work on iOs, too.

The TinyURL API requires a key, which you can get for free if you have an account. With the API key, you can shorten 600 URLs per month.

Supposing that’s enough, I’d go about it like this:

  • Create a JSON data set as described here URL Shortener, Branded Short Links & Analytics | TinyURL
  • Use curl to POST this data set to tinyURL
  • convert the JSON response to an object
  • retrieve the TinyURL link and copy it to the global Clipboard (if that’s what you want)
  • alternatively, I’d store the TinyURL as a custom metadata with the DT record.

So, it’s feasible. I had a brief look at alternative services, but they all seem to work in the same way: There’s a certain number of free shortenings a month, requiring an account and an API key.

It would be equally nice if Notion and related services would support custom URL schemes. In my mind, that would make more sense than requiring a ton of other apps to provide for URL shortening just because they don’t want to support different URL schemes. Basically, an app shouldn’t bother at all with the protocol part of a scheme and consider the URLs to be only text.

PopClip got a Shorten Link Extension.

1 Like

You might consider using Hookmark. https://hookproductivity.com/help/integration/using-hook-with-notion/

:+1:
PopClip uses is.gd, which offers a free API with generous daily and hourly limits. So, it would be possible to automate this along the steps I outlined above.

Have you contacted the developers of those apps and requested they support URL schemes in general, and ours specifically?

Yes! Many times

We appreciate the effort. :slight_smile:

I think they don’t want to implement that kind of links

I tried it two years ago, and it is to complicated and doesn’t work on iOS

I tried a lot of things and apps in last two years, and that is a big unsolved problem for my workflow. I write to DT about that twice and would be happy if DT could solve it

That’s their prerogative. However, URL schemes are fairly widespread nowadays and some apps have no scripting support. URL schemes, if the app lacking scriptability has one, can be useful in that situation. But again, inter-application communication has to be a priority for the developers of Notion (or other apps).

Perhaps you should consider an alternative that supports URL schemes. Just a thought.

I tried all alternative apps, only Todoist supports that kind of links

I tried it, too, but it doesn’t work on iOS, too

Thanks for you solution, but it is very complicated

I’m so sorry.

You could try to write a shortcode instead. That might work on iOS. But it seems that most free URL shorteners do not recognize the x-devonthink-item: protocol, so they’ll simply not shorten that. So, you’re basically back at “get a TinyURL API key, build a shortcode that constructs the proper POST request, sends it to TinyURL.com and extracts the shortened link from the response.” I doubt that it gets less “complicated” than that.

Thanks. Today I write Notion about that again, and get that response - «Hi there,

I appreciate you for sharing your query.

In this case, I’ll pass this to a specialist on our team to look into this for you. We’ll keep you posted in this thread with any updates. I appreciate your patience.

Please don’t hesitate to let us know if we can help you with anything in the meantime.»

2 Likes