Skip to content

Instantly share code, notes, and snippets.

@guanix
Created April 11, 2010 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guanix/362418 to your computer and use it in GitHub Desktop.
Save guanix/362418 to your computer and use it in GitHub Desktop.

Watch my video explanation!

in_reply_to_id

in_reply_to_id is a piece of information that may be associated with a tweet. It is a reference to the tweet that is being replied to. On twitter.com, you can tell that in_reply_to_id is set because the “in reply to” link is visible. In other Twitter clients, there may be a similar link or an icon to show a discussion thread.

If in_reply_to_id is not set, then it can be difficult or impossible to tell which tweet is being replied to, and it can be difficult to reconstruct discussion threads.

Reply visibility

The rule is: A tweet is not visible to all followers (but only those who follow both parties involved) if both of the following are true:

  1. in_reply_to_id is set on the tweet
  2. the tweet begins with the @username of the person being replied to

Conversely, a tweet will be visible to all followers if any of the following are true:

  1. it does not have in_reply_to_id information (and no “in reply to” link appears on twitter.com)
  2. if it has in_reply_to_id, it does not begin with the @username of the person whose tweet is being replied to

Conceptually, if you want your reply to be visible to all followers, you must do one of the following:

  • Ensure that in_reply_to_id is not set.
  • Do not start your tweet with the @username of person you are replying to.

Examples

This tweet will only be visible to followers of both @guan and @JulieKlam because it has in_reply_to_id set (notice the “in reply to” link) and it begins with @JulieKlam:

julieklam

This tweet will be visible to all followers of @guan because it does not have in_reply_to_id set (notice that there is no “in reply to” link):

steffentchr

This tweet will be visible to all followers of @guan. Although it has in_reply_to_id set, it does not start with @wunderingaloud:

wunderingaloud

This tweet, which begins with .@, will be visible to all followers of @guan because it lacks in_reply_to_id. However, it would also have been visible if I had removed the initial period.

steffentchr

An example of someone doing this while explaining replies:

ed

The same is the case with this tweet:

powerofno

This form is relatively rare. It has in_reply_to_id set, so threads can be tracked, but it starts with .@ so all my followers can see it:

steffentchr

Why .@ is usually wrong

A commonly given piece of advice is to prepend the initial @ with a period (.).

In so far as this is done to remove the second condition of the reply visibility rule, so the tweet no longer begins with the @username of the person being replied to, this is a reasonable piece of advice. However, I do not find the .@ aesthetically pleasing and prefer a more natural solution, described below.

The problem is that with many Twitter clients, and in particular twitter.com, in_reply_to_id will be cleared (not set) as soon as you type something in front of the @username, for example a period. Since removal of in_reply_to_id removes the first condition of the tweet visibility rule (in_reply_to_id being present), handling the second condition (not starting with @) is no longer necessary.

In other words: Since in_reply_to_id is gone, the .@ is unnecessary!

(A twist is that twitter.com will add back in_reply_to_id if you remove the . again.)

It’s also a Bad Thing to remove in_reply_to_id because you can’t see what tweet is being replied to and Twitter clients can’t reconstruct discussion threads.

A different way to achieve the same effect, and save a character, is to not use the Reply button at all, so your client will not set in_reply_to_id. For example, if you are replying to one of my tweets and wish it to be visible to all followers, you can ignore the Reply button and simply start typing a new tweet that begins with @guan:

@guan I completely agree.

This tweet will not have in_reply_to_id set and will be visible to all followers. Since in_reply_to_id is not set, you can ignore whether the tweet starts with @guan.

The Correct Way to Reply, Part 1

Our goal is to construct replies that are visible to all followers and which have the “in reply to” link so threads can be reconstructed.

This is easy in sane Twitter clients. We need to:

  1. Use the Reply button so in_reply_to_id information is captured and sent to Twitter.
  2. Write some text in front of the @username so the tweet will be visible to all users.

This can be insanely hard or even impossible in some Twitter clients.

The second step is easy: Just put some text in front. This could be a period or some words that make the tweet sound like a sentence:

That, @guan, is very clever.

The problem, as we shall see, is that as soon as you attempt this second step, many clients’ behavior with respect to the first step (in_reply_to_id) will change.

The Correct Way to Reply, Part 2

I’m too lazy to read all this

If you are in a hurry and want to write a reply that will be visible to all followers, just do the following:

Do not hit the Reply button. Just start typing out a tweet, beginning with the @username of the person you are replying to. For example:

@guan That was quick and easy.

No in_reply_to_id information will be sent, so the tweet will be visible to all users, and the tweet does not start with the ugly “.@”.

twitter.com

twitter.com sets in_reply_to_id when you hit the “reply” button below a tweet.

If you start typing some text before the @username after clicking the “reply” button, twitter.com will clear in_reply_to_id.

If you remove the text before @username again (but without removing the @username part), twitter.com will put in_reply_to_id back.

As far as I know, there is no way to construct correct replies that are visible to all users with twitter.com.

Note: When you are typing a reply, the headline at twitter.com changes from “What’s happening?” to “Reply to X”. This is not an indication of whether twitter.com will send in_reply_to_id. It also changes to “Reply to X” if you simply start typing a @username and did not use the reply button.

replyto noreplyto

Echofon for Mac

Older versions of Echofon for Mac exhibited behavior similar to twitter.com.

Newer versions will preserve in_reply_to_id if you prepend @username with some text:

echofon

(Echofon for Mac allows you to clear in_reply_to_id by clicking the X.)

So replying correctly with Echofon for Mac is easy:

  1. Click the reply icon next to a tweet.
  2. Write something before the @username in the tweet field, for example a period or some text.

Tweetie

Tweetie for Mac and iPhone have the same reply behavior as Echofon. See the instructions above.

TweetDeck (on the desktop)

In TweetDeck, on the other hand, in_reply_to_id information is cleared as soon as you start typing before the @. I am not sure how to do correct replies visible to all followers in TweetDeck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment