This happened once before, when I came to your door
April 23, 2009 at 4:00 PM by Dr. Drang
The Twitter API documentation is pretty well written, and it was a great help while I was turning Peter Krantz’s Twoot into Dr. Twoot, the Fluid-based Twitter client I use. But as the Twitter API changes, its documentation sometimes doesn’t keep up. Such is the case with the in_reply_to_status_id
parameter that’s used to keep Twitter replies (now called mentions) tied to the their original tweets.
I’ve blogged about Dr. Twoot more than a few times. One of its features is a retweet button—a triangular recycling symbol—in the upper right corner of each tweet.
Clicking the retweet button copies the text of the tweet into the status field down at the bottom of the window and prepends it with “RT @username” and a space. In addition, behind the scenes, it sets the in_reply_to_status_id
parameter for the tweet. I thought this was a thoughtful touch; a link back to the original tweet that readers could follow by clicking the “in reply to @username” link that comes below a tweet on the Twitter page (and is usually present in some form on other Twitter clients1).
It worked perfectly. I’m not much of a retweeter, but it always worked in my testing of the code, and it worked the two or three times I did retweet someone.
Until last week. I retweeted someone and noticed that the “re @username” link wasn’t there. Figuring I must have done something wrong, I deleted the tweet and tried again. Same thing. After a bit of experimenting, I learned that Twitter is now deleting the in_reply_to_status_id
parameter unless “@username” is at the beginning of the tweet.
This is not only a change in behavior, it’s at odds with the documentation, which describes the parameter this way:
in_reply_to_status_id
. Optional. The ID of an existing status that the update is in reply to. The user of the tweet referenced by this status_id must be mentioned (@username) within the tweet.
It says that @username must be within the tweet, not exclusively at the beginning of the tweet. This is a perfectly accurate description of the way Twitter used to work, but not the way it works now.
You can test this for yourself easily enough. Go to this tweet by @cnnbrk and click the little reply arrow. When the page reloads and you see the equivalent of this
put some text and a space character before the “@cnnbrk” and send it out. You’ll see something like this
with no “in reply to @cnnbrk” link at the end. Had the “testing…” come after “@cnnbrk” the reply link would have been there. (Go ahead and delete that tweet so you don’t annoy your followers.)
You can also test this from the command line with the curl
utility. Execute
curl -u user:password -d in_reply_to_status_id=1545105262 -d status=testing%20@cnnbrk http://twitter.com/statuses/update.xml
using your own Twitter username and password. The number 1545105262 is the id of @cnnbrk’s original tweet; the “%20” in the status part is an encoded space character. When you run this, you’ll get a typically verbose XML output. Between five and ten lines down, you should see lines like this:
<in_reply_to_status_id></in_reply_to_status_id>
<in_reply_to_user_id></in_reply_to_user_id>
That these are empty tags—despite your explicit setting of in_reply_to_status_id
in the command—is another way of showing that Twitter is ignoring that parameter when “@username” isn’t at the beginning of the status string. (You should also go to the website and delete this tweet before you forget.)
I’m not sure when this change occurred, but I suspect it was about a month ago, when replies got turned into mentions. It used to be that Twitter only tracked replies, which were defined as tweets that began with “@username” (regardless of whether the in_reply_to_staus_id
parameter was set). Now Twitter tracks mentions, which are tweets that have “@username” anywhere within them. Maybe the change in behavior was inadvertent; maybe it was deliberate and the Twitter guys just forgot to change the documentation along with the code.
Whatever the source, I think in_reply_to_status_id
should work the way the documentation describes. If that parameter is set, it should be honored. I see no reason for dropping it just because the @username is buried in the middle of the response.
Off topic: You’d think, given the name of this blog (scroll 48 seconds in) and the richness of the canon, that I could come up with a Lennon lyric—or at least a Beatle lyric—for the title of almost every post. But here I stand, head in hand.
-
Dr. Twoot uses “re @username” as the text of its link to the original tweet. ↩