Recieve real-time updates to user timeline


#1

Hi!
Is it possible to use the twitter api to recieve real-time updates of a user timeline? If so, what would be the best way?

Sorry if this isn’t the correct subforum.
Thanks!


#2

Sure, best one to use is https://developer.twitter.com/en/docs/tweets/filter-realtime/api-reference/post-statuses-filter with the follow parameter


#3

Thanks!
A couple of follow up questions:

  1. Will this really send updates when the user’s timeline updates due to a tweet from another user he is following?
  2. Is there any limit to the amount of users you can apply this to?
  3. Is it free?

#4

Oh, i thought you meant user timeline as in 1 specific user’s tweets like a streaming equivalent of https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline , not tweets by anyone a specific user is following like https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline

In both cases though, the filter endpoint is what you’ll need - it’s free and there’s a 5000 id limit on the number of users you can track, and you can keep open 1 such connection. You can get user ids of accounts someone is following with https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-friends-ids


#5

Thanks, I’ll give it a try!

Btw, I was looking into webhooks(https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/guides/getting-started-with-webhooks.html) earlier. Do you know if I can get updates when a user’s timeline is updated (due to his friend’s tweets) from that? I thought so at first but I’m unsure now.


#6

Not for any tweet, but partially yes: https://developer.twitter.com/en/docs/accounts-and-users/subscribe-account-activity/guides/account-activity-data-objects here’s stuff you get from Activities API - so whenever a someone Retweets, Replies, @mentions, QuoteTweets you, you’ll be able to get those messages, but not when anyone you follow makes any kind of tweet - just one that includes you.


#7

What you’re describing and requesting is real-time updates to what we call a user’s “home timeline” i.e. all of the Tweets the user would see if they opened twitter.com and looked at the stuff flowing in from the people they follow. This is no available in the API, but you can approximate it. You can also poll the RESTful home_timeline endpoint, but this is not realtime.


#8

Thanks Igor! you saved me a lot of time. I’ll look into the filter realtime feature :slight_smile:


#9

Ok thanks! Yeah I have tried polling it but I’d prefer realtime.