How do you stream only followed users

Feb 4, 2014 at 11:47 AM
I need to stream only those I follow. I cant quite understand how to approach this.. Is there a method for it (in underlying API) and if yes is it implemented in the TweetInvi?

Or shall I stream all tweets but then filter them by the author locally?
Feb 4, 2014 at 12:04 PM

You need to use the UserStream. The goal of the userstream is to receive all the events related with an account.
When a follower post a tweet for example the information will be received by the userstream.

var userStream = Stream.CreateUserStream();
userStream.TweetCreatedByAnyoneButMe += (sender, args) =>
      Console.WriteLine("Tweet created by {0}", args.Tweet.Creator.Name);
IUserStream userStream = new UserStream();
us.TweetCreatedByAnyoneButMe += (sender, args) =>
       Console.WriteLine("Tweet created by {0}!", args.Value.Creator.Name);
Hope this helps.
Feb 4, 2014 at 12:19 PM
Gotcha thanks very much.. I almost done here :)
Feb 4, 2014 at 1:12 PM
Edited Feb 4, 2014 at 1:13 PM
Ok.. sorry.. it doesnt work as I thought it would be..

For example.. I have subscribed to @Reuters. And on my Twitter home page are tweets from @Reuters (that what I want).. But in the TweetInvi I am getting Reuters and others (I dont know what they are but the text mentioned @Reuters but is not the author... For example some guy called Fallapart The Clown writes some text started with "@Reuters" - seems people replying to the @Reuters tweets (I guess))..

My code:
        private IUserStream StartUserStream(IToken token)
            IUserStream us = new UserStream();

            us.TweetCreatedByAnyone += (sender, args) =>
                this.Dispatcher.BeginInvoke(new Action(() =>

            var a = new Action(() =>

            a.BeginInvoke(null, null);

            return us;
so basically I need to replicate Home page of my Twitter account.

Its almost there just one more push and I am good to go! :))

Thank you
Feb 4, 2014 at 1:27 PM

You are pointing something that I did not considered when doing the UserStream.
I will have a look to this specific problem and get back to you probably tonight.

Feb 4, 2014 at 1:28 PM
You are the star! Thanks a ton!
Feb 5, 2014 at 12:41 AM
Hi there,

I have not yet implemented the solution but basically the logic is pretty simple.

The FriendIdsReceived event will send you the ids of all the users you are following.
When getting the tweets you can filter based on this list.
event EventHandler<GenericEventArgs<List<long>>> FriendIdsReceived;
I will implement this feature in Tweetinvi but it seems you are using 0.8 consequently just store the list and filter based on it ;)

Feb 5, 2014 at 9:31 AM
will do.. not too big deal... I got 0.8 from the download page... shall I use code repository and compile 0.9 myself or how it works with this project?
Feb 5, 2014 at 9:44 AM

Tweetinvi 0.9 is still not accessible through the MainPage Download button but you can access it by downloading the Source Code and compiling the Development project.

This is getting more and more stable and the release will happen between 2 to 4 weeks after 5 months of development :)
There are few differences but the goal of 0.9 is to simplify the development and the Examplinvi project will help you going through.

Download Tweetinvi 0.9

I will let you know when the feature is implemented.

Marked as answer by linvi on 2/5/2014 at 2:42 PM
Feb 5, 2014 at 9:45 AM
Feb 5, 2014 at 10:18 AM
Edited Feb 5, 2014 at 5:59 PM
This discussion has been copied to a work item. Click here to go to the work item.
Feb 5, 2014 at 10:42 PM
This is now implemented in Tweetinvi
var ustream = Stream.CreateUserStream();
ustream.TweetCreatedByFriend += (sender, args) =>
    Console.WriteLine("Follower {0} posted : '{1}'", args.Tweet.Creator.Name, args.Tweet.Text);
Also for the information, TweetCreatedByAnyone will send tweet created by followers and tweets from users who reply to tweets of followers.

Marked as answer by linvi on 2/5/2014 at 2:42 PM
Feb 5, 2014 at 11:17 PM
Very nice. Thank you.. Will try tomorrow morning.