Search code examples
twitter

Replies to a particular tweet, Twitter API


Is there a way in the Twitter API to get the replies to a particular tweet? Thanks


Solution

  • From what I understand, there's not a way to do that directly (at least not now). Seems like something that should be added. They recently added some 'retweet' capabilities, seem logical to add this as well.

    Here's one possible way to do this, first sample tweet data (from status/show):

    <status>
      <created_at>Tue Apr 07 22:52:51 +0000 2009</created_at>
      <id>1472669360</id>
      <text>At least I can get your humor through tweets. RT @abdur: I don't mean this in a bad way, but genetically speaking your a cul-de-sac.</text>
      <source><a href="http://www.tweetdeck.com/">TweetDeck</a></source>
      <truncated>false</truncated>
      <in_reply_to_status_id></in_reply_to_status_id>
      <in_reply_to_user_id></in_reply_to_user_id>
      <favorited>false</favorited>
      <in_reply_to_screen_name></in_reply_to_screen_name>
      <user>
        <id>1401881</id>
         ...
    

    From status/show you can find the user's id. Then statuses/mentions_timeline will return a list of status for a user. Just parse that return looking for a in_reply_to_status_id matching the original tweet's id.