Twitter Tweaks 140 Character Calculation

Today, Twitter announced a number of changes aimed at creating richer public conversations by eliminating elements that currently count towards the 140 character limit. Certain elements that previously ate into the 140 character cap (e.g. media attachments, @names that auto-populate when you hit reply to a Tweet, URLs at the end of Tweets, etc.), will no longer count as characters when calculating 140 characters. Twitter will roll out the changes in the coming months. While the changes will empower users to do more with words, developers must be aware of the affects the changes will have on various developer tools.

Changes will affect the Twitter API, the Twitter Ads API, Gnip data products, and various display products such as Fabric's Twitter Kit. Because usernames and attachment URLS will no longer count towards the character limit, the Tweet JSON object can exceed 140 characters. Accordingly, developers must avoid hard-coding length assumptions into apps. Further, text should be divided into three logical regions: a hidden prefix region (may contain one or more space-separated @mentions which does not show up as part of the display text), a display text region (140 characters), and a hidden suffix region (may contain one attachment URL which does not show up as part of the display text, but identifies an attachment Resource: one to four photos, one GIF, a video, poll, Quote Tweet, or DM deep link). If text contains a hidden prefix or suffix regions, the Tweet object will contain values that identify the start and end indices of the region of text to be displayed as Tweet text.

To assist developers with the changes, Twitter has added new API Endpoint options. Options include new boolean parameters when a Tweet is sent as a reply, new Tweet mode request parameters, valid request values now include compat and extended, and more. For complete details, check out the developer documentation.

Twitter has not rolled out the changes just yet. The idea behind the announcements is to give developers ample time to adjust to the upcoming changes. Twitter anticipates the changes will simplify both the parameters by which Twitter users operate and how developers integrate Twitter products and services into third party applications. However, Twitter is well aware that developers are comfortable and very much attuned to the legacy architecture around Twitter developer tools. As always, Twitter encourages developers with questions to reach out to the team. 

Be sure to read the next Tweets article: Gnip Audience API Now Features Twitter Aggregate User Age Information