Shortening URL - either bit.ly or short.io

Continuing the discussion from Link shortener with Experimental column:

Hi,
I’ve recategorized this for “How To” as I’m not sure this need to be under an experimental code.
Trying to shorten a url using either bit.ly or short.io. This worked perfectly on Google Script, but I cannot get it to work on Glide. Tried all possible column types, including the experimental code suggested in the discussion above.

From Short.io, I got this url:
https://api.short.io/links/tweetbot?domain=YOURDOMAIN&apiKey=SECRETKEY&originalURL=https://google.com/

This works fine (using a secret key) when opening it in a browser. It generates a shortlink and the short link is working.
I simply cannot get it to work inside Glide.

Rather similar situation with bit.ly, although I played with this option less.

Any ideas?

You need to use api column

1 Like

Sure, tried it.
fetch JSON column directed towards the column with that short.io URL.
Not getting anything. Just an empty column.

Have you tried using a Construct URL column?

1 Like

I use webhook to create the short.io links and a construct URL column to use within the app. Used it to develop this:
Dygi.me — My first ever SaaS built with Glide

1 Like

Wonderful app, but I can’t see below the hood. Reading the follow-up posts on that showcase, I understand you’re using Zapier. While it’s a great, and super-clean solution, I prefer to avoid it as I don’t want to give Zapier access to these confidential Google Sheets. Any other ideas?

Hi
I was able to create the URL which I plan to send to the API using template. My logical skills are still not sharp enough to grasp the full power of Construct URL, but template is fine for now.
The second step is where I’m stuck. Using Fetch JSON column but not getting anything back.
image

When I manually follow the same exact link from the template column I do get a response (masked some part with XXX):

{“id”:1172828683,“DomainId”:259875,“OwnerId”:260172,“clicksLimit”:null,“path”:“Z5bUSl”,“originalURL”:“https://google.com/",“cloaking”:false,“archived”:false,“redirectType”:302,“icon”:null,“title”:null,“iphoneURL”:null,“androidURL”:null,“expiresAt”:null,“expiredURL”:null,“source”:“api”,“splitURL”:null,“splitPercent”:null,“integrationGA”:null,“integrationGTM”:null,“integrationFB”:null,“integrationAdroll”:null,“createdAt”:“2021-12-27T19:59:56.000Z”,“updatedAt”:“2021-12-27T19:59:56.000Z”,“secureShortURL”:“XXXXXXXX/Z5bUSl”,“idString”:“lnk_15Bx_1hn4jF”,“shortURL”:“XXXXX/Z5bUSl”,"duplicate”:true}


edit:
Just found this tutorial but I still get this to work inside a Glide column… :frowning:

My reason for suggesting the Construct URL column is that it will automatically take care of URL escaping where necessary. It’s just a guess, but that’s what might be tripping you up here.

Understood, thanks.
Any thoughts about why the JavaScript column isn’t working, although it’s working perfectly fine on Google Script?

My only thought was that there might be some characters in the templated URL that is causing it to break. Which again, is why I suggested the URL column.
Pasting it into a browser most likely works because most browsers will automatically add URL escaping. You could test this by copying the URL that your browser produces and pasting it back into a template column, and then try that with the Fetch JSON column.

Again, this is just a guess.

I 100% agree with you that the Construct URL solution is the best way to move forward here, but I’m truly struggling with it.
When I configure this:

I get this URL:
https://api.short.io/links/tweetbot?domain=XXXXXX&apiKey=XXXXXX&originalURL=WALINK?WALINK=https%3A%2F%2Fwa.me%2Fsend%3Fphone%XXXXXXXX

In other words. not sure how to use the parameters section here…


OK, I might have partly understood how to use these parameters:

But it still doesn’t work. The response I get is:

{“error”:“No originalURL parameter provided”,“success”:false}

I have provided this parameter but I think that it’s actually something with the transitioning to percentage URL coding. It’s not recognized by either WhatsApp (when trying to run manually in a browser) or by Short.io, as you can see in the response above.

Have you tried the above?
If that works, it would confirm that you need the Construct URL column. If it doesn’t work, then the problem lies elsewhere.

Anyway, for your Construct URL column:

  • Data
    https
    api.short.io
    links/tweetbot
  • Query Parameters
    domain : XXXXX
    apiKey : XXXXXX
    originalURL : WALINK

If you can manually follow that link and get a response but not in Glide, I think this is a CORS problem and I haven’t found a way to deal with it when I ran into it.

1 Like

Happy to say that I solved it, or at least I think so… :slight_smile:
Simplest solution was to add another service to the party: shareaholic

Once registered at both shareaholic and Bit.ly, we build something like this:
first column - thanks to @Darren_Murphy
image

Second column

Note, parameters:
apikey - free from shareaholic
url - pointing to the first column
service[token] - free from Bit.ly

Third, and last, column
image

And now, we have a short URL curtesy of Bit.ly and shareaholic :slight_smile:

2 Likes

Looking at your screenshot, a giant red flag for me was that you had ‘originalURL=’ as a query parameter name instead of ‘originalURL’. That extra equal symbol probably resulted in a parameter name of ‘originalURL==’. Which makes sense that the error you were given was ‘No original url parameter’. It couldn’t find the parameter value because no value existed after the first equal symbol, other than another equal symbol, and the second equal just threw everything off.

3 Likes

Hi
Yes, you’re right. I also noticed it after posting. I corrected it but, sadly, it didn’t do any good.
Happy to review your solution if you can make it work. I actually prefer short.io to bit.ly, but at the end of the day they’re both fine.
Thanks

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.