I’m getting an error via the API that the tweet has exceeded the char count but it hasn’t. Upon investigation i’m seeing that the problem is the image i’m attaching (bytes). If i run a test without the image it works. Is there a size limit on images and why is it giving me an incorrect error message?
When you attach an image to a Tweet, you’ll need to leave 23 characters to account for the t.co URL for the image. So, if your text is longer than ~115 characters then your Tweet is indeed too long.
Thanks for that. I had been adding my own bitly link and started noticing that twitter was doing this automatically (a few months ago) and then my posts started appearing with 2 links. I’ve counted the tweet with my own bitly but are you saying the 23 characters are the ones that twitter adds automatically?
Yeah, so if you attach an image to a Tweet, there will be an autogenerated t.co link to the pic.twitter.com image, which will be added to the body of the Tweet. Those links are currently 23 characters, but you need to also have a preceding space, so that’s 24. There’s a value “characters_reserved_per_media” in the
/1.1/help/configuration.json endpoint which reflects that.
Fantastic, i’ll give it a go.