Twitter Tweaks 140 Character Calculation

Twitter-LogoToday, 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.Related: Twitter’s Jack Dorsey to Developers: We’re Sorry. Let’s Start Over.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.

Source: Twitter Tweaks 140 Character Calculation | ProgrammableWeb

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *