Doing more with 140 characters

Tuesday, 24 May 2016

In 2006, when we introduced Twitter’s API, Tweets were simple 140-character text messages, often sent via SMS. Now, the products and apps built using Twitter data feature Tweets that include photos, GIFs, videos, polls, and more.

Today, we’re excited to announce an upcoming set of changes rolling out over the coming months to enable people to express even more within 140 characters. These changes will allow for richer public conversations that are easier to follow on Twitter, and ensure people can attach extra elements, media, and content to Tweets without sacrificing the characters they have to share their view.

Our goal is to give developers and partners this advance notice of changes to the format of Tweets so that they can prepare their products and applications appropriately.

What is changing?

We are simplifying the way that replies and attachments work on Twitter by moving some of the “scaffolding” of Tweets into display elements so they no longer count towards the character limit within the Tweet.

  • Replies: @names that auto-populate at the start of a reply Tweet will not count towards the character limit (but new non-reply Tweets starting with a @mention will count, as will @mentions added explicitly by the user in the body of the Tweet). Additionally, new Tweets that begin with a username will no longer have to use the ”.@” convention in order to have those Tweets reach all of their followers.
  • Media attachments: A URL at the end of Tweets generated from attaching photos, a video, GIF, poll, Quote Tweet, or DM deep link will also not count towards the character limit (URLs typed or pasted inside the Tweet will be counted towards the character limit as they do today).

Compatibility, and what this means for developers

Backward and forward compatibility for third party clients and other API users are our primary considerations.

There are a number of areas that will be impacted by the change:

  • Public REST and Streaming APIs
  • Ads API
  • Gnip data products
  • Display products, such as Fabric’s Twitter Kit for embedded Tweets and timelines displayed on iOS, Android, and web

Tweet object changes

The following items will change within Tweet payloads:

  • The displayed text in a Tweet does not exceed 140 characters, but - when usernames or attachment URLs are included at the appropriate points in the Tweet - the overall Tweet JSON object will be able to exceed 140 characters. Developers must avoid hard-coding length assumptions into their applications.
  • The text shall be logically divided into three regions:
    • A hidden prefix region that may contain one or more space-separated @mentions which shall not be rendered as part of the display text, but must instead be rendered as metadata.
    • A display text region, which remains 140 characters in length.
    • A hidden suffix region that may contain one attachment URL which shall not be rendered as part of the display text, but must instead be rendered as metadata. This region is limited to containing a single URL entity that identifies an attachment resource: currently, one to four photos, a GIF, video, poll, Quote Tweet, or DM deep link.
  • If the text contains a hidden prefix or suffix region, then the Tweet object shall contain values to identify the start and end indices of the region of the text to be displayed as the Tweet text.

To support these changes, there will also be a few new options on API endpoints that create or consume Tweets. For more detailed information, we’ve written initial technical documentation. Full updates across Twitter’s existing API documentation will be provided when the changes are deployed in the future.

If you have questions, please post them in our TwitterDev community forums or Tweet us @TwitterDev. In addition, stay tuned to announcements from @TwitterDev as we get closer to shipping these changes. We’re here to help you transition your products successfully to take advantage of these exciting new features.

*Editor's note: As of November 2017, Twitter has increased the character count of Tweets in certain languages to make it easier to share what’s happening.


This post is unavailable
This post is unavailable.