[Streaming API] Get Tweets and Replies for the User

May 28, 2015 at 6:44 PM
Hello All

This is [Streaming API] related question

I need to see a user initial tweets and all replies to it

Can you please recommend the strategy and example of the code for Streaming API

Regards
Ozzy
Coordinator
May 28, 2015 at 9:40 PM
Hi,

I am not sure that I understand what you want to do.
If you want to get the initial tweets for a specific user you will need to use the Timeline static class.

Getting replies more complicated because there is no such endpoint in the API unfortunately. It has been asked multiple times but it isn't possible to access the conversation endpoint with application credentials that are not the one of Twitter.

Cheers,
Linvi
May 29, 2015 at 3:00 PM
Hello I just check Streaming API documentation

and see following functionality

if i add:
var stream = Stream.CreateFilteredStream();
stream.AddFollow(5402612);
it shows only original user Tweets, but not other users replies, that i need

am i missing any parameters here? (like replies=all)

This is a part of documentation:

follow
A comma-separated list of user IDs, indicating the users whose Tweets should be delivered on the stream. Following protected users is not supported. For each user specified, the stream will contain:

Tweets created by the user.
Tweets which are retweeted by the user.
Replies to any Tweet created by the user.
Retweets of any Tweet created by the user.
Manual replies, created without pressing a reply button (e.g. “@twitterapi I agree”).
The stream will not contain:

Tweets mentioning the user (e.g. “Hello @twitterapi!”). Manual Retweets created without pressing a Retweet button (e.g. “RT @twitterapi The API is great”).
Tweets by protected users.
Coordinator
May 29, 2015 at 3:52 PM
Hi,

I will have a look into this and get back to you.

Linvi
Coordinator
May 29, 2015 at 4:12 PM
FilteredStream is working properly and returns as expected replies to tweets that were created by the followed user.

You don't miss anything. Are you sure that the user who replied to the tweet is not a protected user?

Linvi
May 29, 2015 at 6:52 PM
This code actually works. Problem was that i originally used StartStreamMatchingAllConditions and should be StartStreamMatchingAnyCondition for my case.

Thanks
            var stream = Stream.CreateFilteredStream();
            stream.AddFollow(759251); // CNN

            stream.MatchingTweetReceived += (sender, args) =>
            {
                var tweet = args.Tweet;

                /// to do something
            };

            stream.StartStreamMatchingAnyCondition();
Marked as answer by Gravitcapa on 6/1/2015 at 12:33 PM