3

Is there any way to find out when was the last time a user was active, that is, either the last login date or tweet or retweet on Twitter via API? Any activity of a user.

rdoubleui
  • 3,554
  • 4
  • 30
  • 51

1 Answers1

1

This answer assumes you're watching a known list of Twitter users.

Pretty sure that you are not going to see the login date/time. If you request the user's tweets from the user's timeline, then those tweets are sorted by date/time (GET on https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&include_rts=true). You might need to set include_rts to true in order to get back retweets. The time of the latest tweet gives you the time of the last activity.

Additionally you can add trim_user=true to keep the payload smaller.

Notice that those requests do count into the rate limit count. You can do bulk requests by using the users/lookup request, which lets you query up to 100 users with one request, which is more rate-limit-friendly.

Reference: https://dev.twitter.com/rest/reference/get/statuses/user_timeline

rdoubleui
  • 3,554
  • 4
  • 30
  • 51