0

I'm using the goo.gl link shortener API in my app to send urls to twitter along with a link. I've been allowing users to submit 119 characters, appending a space, and then the URL because I was under the impression that they were always 19 characters. This should leave me with one to spare.

Unfortunately I've been getting some "tweet is too long" errors and I can't seem to find any documentation about the possible range of goo.gl url lengths. Does anyone know what the max is or know where some reliable documentation on it is?

Sherms
  • 1,567
  • 1
  • 15
  • 31

1 Answers1

2

Twitter now automatically shortens all links by itself, using t.co. Don't do it by yourself.

Read: https://dev.twitter.com/docs/tco-link-wrapper/faq#How_do_I_calculate_if_a_Tweet_with_a_link_is_going_to_be_over_140_characters_or_not

If you are not using the opt-in features, only links shorter in length than a t.co URL will be wrapped by t.co. All links t.co-length or longer should be considered as t.co's maximum length. For example, if help/configuration reports 20 characters as the maximum length, and a user posts a link that is 125 characters long, it should be considered as 20 characters long instead. If they post a link that is 18 characters long, it's still only 18 characters long.

At the moment short_url_length is equal 22 (https://api.twitter.com/1/help/configuration.json)

John
  • 3,954
  • 2
  • 11
  • 4
  • Does not really answer my question, which was what is the goo.gl maximum. That's precisely why I use goo.gl, originally it was 19 characters which frees up those extra 3 for my users. It also was not variable, so I didn't have to check whenever I wanted to use it. – Sherms Mar 07 '13 at 16:13
  • It doesn't matter if you use goo.gl or not - Twitter will shorten goo.gl link to t.co as well. – John Mar 08 '13 at 08:25
  • Hey John, I owe you an apology. You were right. According to Twitter: "As of October 10, 2011 the t.co URL wrapper automatically wraps all links submitted to Twitter, regardless of length. This includes so-called URLs without protocols." So while my goo.gl urls might still show up in the tweets themselves, behind the scenes a t.co wrapper is put in place and counted towards the character total. This seems like a poor development choice to me, but it is what it is. Again, sorry for being rude in my last comment. Turns out you were right. – Sherms Mar 13 '13 at 18:11