Tweet's replied users, retweet's following users

Dec 23, 2010 at 4:53 PM

Hi Joe,

 1) I need to find users who replied to my tweet.

2) I need to find users who are following my retweet.



Dec 24, 2010 at 4:53 AM

Hi Shahid,

1. There isn't a specific API call for getting replies, but I think it can be done with a Search query.  I would approach this by filtering on tweets to a user and constraining the results with a since_id or since date.  (Note: with the implementation of the Twitter snowflake id distribution scheme, since_id is no longer guaranteed to be sequential).  Then do a query on the returned list of tweets to see which ones are replies to (via the properties of the Status entity).  You'll have to look at the LINQ to Twitter docs on the Search entity and adjust parameters to get this to come out properly, but I think it should work.

2. I'm not sure if I understand what you're askng for on this one.  While you can follow a person, there isn't a concept of following a tweet.  By default, all of your followers will see any of your retweets.  However, there is a new addition to the API, which is a Relationships property on the Friendship entity.  The Relationships object contains a property named RetweetsWanted.  So, you can figure out who saw your retweet by the fact that every one of your followers, except for the followers who had their RetweetsWanted set to false.  The query you would use was recently added and isn't documented yet, but is included in the source code demo.  You'll have to change filters and read the properties you need, but here's the example from the demo:

            var relationships =
                (from look in twitterCtx.Friendship
                 where look.Type == FriendshipType.Lookup &&
                       look.ScreenName == "twitter,joemayo"
                 select look.Relationships)

            relationships.ForEach(rel => Console.WriteLine("Relationship to " + rel.ScreenName + " is " + rel.Connection));