Easiest Way to Shorten URLs?

I had to laugh at this, because I'm also running into the same issue.

Their customer support told me I can get a token on the website at "dev tools -> application -> cookies -> jwtToken", but I'm not finding a "dev tools" section anywhere on the website dashboard or in my settings.

I'm waiting to hear back from them with further clarification, and will let you know what I find out!

I couldn't find anything on my side either :melting_face:

Nothing new from Droplr?

Nothing yet, unfortunately. I'm planning to ping them again tonight if I still haven't heard from them.

I finally heard back from Droplr, @carycrusiau! Here's how you get your token, assuming you're using Chrome...

  1. Sign into your account on the Droplr website.

  2. Right click on any blank space on the website, and select "Inspect" from the Chrome contextual menu. This brings up Chrome's developer tools.

  3. In Chrome's developer tools, select the "Application" tab. (You might need to click on the ">>" button to find it.)

  4. In this tab, on the menu on the left, in the "Storage" section, expand the "Cookies" menu item. You should see "https://d.pr" in there. Click on that.

  5. Towards the bottom of developer tools, under "Cookie Value," you should now see your token.

Let me know if this works for you!

But the method for recovering the token is freaking ridiculous :rofl:

So now, in relation to the Bit.ly macro, we're going to replace the script with:

And the %JSONValue% by:

And… voilà!

Droplr Link.kmmacros (26.0 KB)

1 Like

I totally agree. :sweat_smile:

I can confirm on my end that it works! Thank you so much, @carycrusiau. :pray:t3:

1 Like

I've got an update, @carycrusiau!

The macro has been working well, except that every week or so it would suddenly stop working. I figured out it was because my token had changed. Once I grabbed the new token and inserted it into the script, the macro started working again, at least until the token would change once more.

I reached out to Droplr and asked why this was happening, and they responded:

"Just to clarify, our tokens typically have a one-week expiration period as part of our standard procedure. When you make a request, a new token is returned in the headers. The header you're looking for is 'x-droplr-authorization.' This header is sent with each request, providing a new token automatically. Utilizing this header will allow you to refresh your token as needed."

Based on what he wrote, do you have any ideas on how the script and/or macro can be updated to accommodate for this?

Hi @alexcr,

I took a look at it and, yes, it's possible. You send a request with a valid token and you receive a new token which is valid for one week. So, if you use the macro every day or at least once during the week (before the token expired), you receive a new token and the macro works again for at least a week. We therefore need to use a variable to store and use this new token for the next request. However, if you exceed this period of time, you'll have to go back and get a valid token by connecting to the site and looking for it in the cookies to encode it in the variable. I need a bit of time to check the error messages we get when the 7-day period has expired so that I can build a macro that's as clear and clean as possible so that everyone can understand and use it. And to see how I can deal with the fact that the 'token' variable exists the first time it's used.

Give me a few days and I'll come back with a new macro ready to use.

1 Like

Thanks, @carycrusiau. You're awesome.

Maybe one approach would be to create an additional separate macro that, once a day, pings Droplr to retrieve an updated token, which it then saves to the variable you mention? That way, you'd just about always have a fresh token, even if you haven't used the original macro in awhile.

The only scenario where you'd then have an invalid token would be if, say, your computer has been off or disconnected from the internet for seven days. (And in the uncommon scenario that this happens, there can be an error message that explains to the user how to retrieve a new token from the Droplr website, and that also then provides a method for manually updating the variable to this manually retrieved token.)

An even better solution, if at all possible, would be to have the "daily token refresh" script run on the web. That way you'd always have a fresh token available, even if your computer has been shut down and disconnected from the internet for an extended period. Though that might involve using services beyond Keyboard Maestro.

Very nice idea! We could use a Periodic Trigger to ping Droplr to retrieve a new token every day. I'll look into it!

1 Like

Yep! Then, the only scenario that wouldn't be covered would be if your computer is shut down or disconnected from the internet for over seven days. (Though maybe there's a way to run the script from the web, and not the computer, so that this wouldn't be an issue.)

Happy New Year, @carycrusiau. Any luck yet on updating the macro? No worries if you've been busy with the holidays.

Happy New Year!

I was on holiday for the festive season. Back to work tomorrow. I'll no doubt have the chance to get back to it. Stay tuned!

1 Like

I have been following this thread since the Droplr app has changed significantly, breaking some of my workflows.
I have found this resource: GitHub - Droplr/droplr-js: Official Droplr API Client for Javascript, but I do not know if it can help with this issue. I am not very knowledgeable in node.js, so I am unsure how this could be implemented with KM.

1 Like

Thanks, @carycrusiau. Hope you had a great holidays.

I'm not really an expert in Node.js but I've already used some packages. I installed 'droplr-api' but the Terminal told me about a serious vulnerability linked to Axios, a dependency of 'droplr-api'. The last update of the package was more than 6 years ago. So, for something I don't really need (I'm just trying to help @alexcr with a macro for Droplr), I prefer not to use it.

2 Likes

Hey, @carycrusiau! No rush, of course, but just curious if you had a chance to get back to this? I appreciate your help.

I've got back into it a bit but I have to admit that I'm very busy at the moment. Sorry about that!

No worries, @carycrusiau. Keep me posted and let me know how I can be helpful. :pray:t3: