Twit Menulet's Format for Long Tweets

Twit Menulet Twitter client for Mac logo

1. Introduction

Twit Menulet is a simple, fun, and powerful Twitter client for Mac OS X.  The Twitter service places a 140-character limit on status updates in order to allow sending the updates by text message.  Twit Menulet's “long tweet” format allows for posting of longer messages to Twitter and for their display in client applications.

The long tweet format allows division of a single long message into multiple status updates.  An important feature of the long tweet format is that the individual status updates are intelligible to users of long tweet-unaware client applications.

2. Clients using the long tweet format

At the moment, Twit Menulet is the only application that can send long tweets.  If you want to use long tweets, then please remember that long tweets are designed to be intelligible even to long tweet-unaware clients.  One way to see this is to post a long tweet with Twit Menulet and then view its components using Twitter online.  If you develop a conforming client, please let us know.

3. Creating a long tweet

A long tweet is created by dividing a long message into several individual status updates, according to the following procedure:

  1. Divide the tweet into ordered pieces containing no more than 127 characters each.  The first piece may contain up to 139 characters.
  2. Prepend the unicode character “…” (an ellipsis, hex code 0085) to each piece except the first.  Append the same character to each piece except the last.  This process results in a series of tweets connected by ellipses.
  3. Post the first piece to Twitter as a status update, retrieving the status id after the posting is complete.
  4. Base64-encode the status id of the first piece using the string "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".  Obviously, the status id is encoded as an unsigned long long, not as ASCII text.  The least-significant six bits of the status ID become the rightmost character in the encoded string.
  5. Prepend the base64-encoded status ID of the first piece to the second piece.
  6. Repeat steps 3-5 for each of the remaining pieces.

3. Example of long tweet creation

To send the following tweet:

The left and the right live in parallel universes. The right listens to talk radio, the left's on the Internet and they just reinforce one another. They have no sense of reality. I have now one ambition: to retire before it becomes essential to tweet. --Barney Frank
The tweet is divided into two pieces of 139 and 127 characters that are connected by ellipses:
The left and the right live in parallel universes. The right listens to talk radio, the left's on the Internet and they just reinforce one …
…another. They have no sense of reality. I have now one ambition: to retire before it becomes essential to tweet. --Barney Frank
The first piece is submitted to Twitter and receives the status id 4035266864.  This id is base64-encoded to "DwhUkw", which is prepended to the second piece.  The second piece is then submitted to Twitter as a separate status reading:
DwhUkw…another. They have no sense of reality. I have now one ambition: to retire before it becomes essential to tweet. --Barney Frank

4. Displaying a long tweet

Long tweet-aware clients distinguish “normal” tweets from those that are extensions of a previous “parental” tweet.  A tweet that is an extension is identified based upon the following criteria:

Tweets that are extensions are not displayed independently.  However, extension tweets can offer their text to parental tweets for display.  The coded status id and ellipsis character are both removed from the status text before it is passed to parental tweets.

Tweets for which extensions have been identified and which end in the ellipsis character change their display text by (i) removing the terminal ellipsis character; (ii) appending the display text of the extension.

Note that this process is recursive: the display text of extensions may include text from extensions to the extensions.  This fact requires that, when a tweet that is an extension is identified, the display text of the entire parental chain be updated.

5. Example of long tweet display

Suppose that a long tweet is divided into two statuses as described above:

The left and the right live in parallel universes. The right listens to talk radio, the left's on the Internet and they just reinforce one …
DwhUkw…another. They have no sense of reality. I have now one ambition: to retire before it becomes essential to tweet. --Barney Frank
If the statuses are retrieved in order of posting, the first tweet is retrieved and displayed with its terminal ellipsis character.  On retrieval of the second tweet, the coded status id "DwhUkw" is decoded to yield a status id that is less than the id of the second tweet.  The second tweet is therefore interpreted as an extension and not displayed.  Its parent is set to the first tweet.  The display text of the first tweet is then updated by removal of its terminal ellipsis and appendage of the text of the second tweet (lacking the coded status id and initial ellipsis).  The user interface is updated to reflect the full text of the long tweet:
The left and the right live in parallel universes. The right listens to talk radio, the left's on the Internet and they just reinforce one another. They have no sense of reality. I have now one ambition: to retire before it becomes essential to tweet. --Barney Frank