12

I need to periodically return a list of all new followers of a twitter account (i.e. since the last time the list of followers was retrieved), but the Twitter API only seems to provide functionality for getting a list of all current followers of the account.

Apart from getting this full list every time and comparing it against a stored version of the last time it was retrieved, is there any other way to get hold of the new followers?

Sites such as divvoted.com, mrtweet etc must do this somehow! Am I missing something or does it just need the round-the-houses approach described above?

hello_its_me
  • 743
  • 2
  • 19
  • 52
Mark Perkins
  • 260
  • 2
  • 10

4 Answers4

16

Yes, you have to keep the list of followers since last update, because twitter does not associate api clients to state. The definition of 'last time the list was retrieved' lacks 'by whom'.

Jan Jungnickel
  • 2,084
  • 14
  • 13
  • 3
    Thanks Jan, i guess what I was looking for is a 'get new followers since (timestamp)' and a 'get users who have unfollowed since (timestamp)' so i didn't need to go through the whole list. That way there wouldn't need to be any client/state issues. – Mark Perkins Apr 24 '09 at 09:37
2

You always can try to catch the mails from Twitter with the message: "... is following you on Twitter". This might be a bit harder than using the Twitter API and there is a chance of missing mails (in case mails are not delivered), but it will safe some valuable API calls. But this does not cover unfollowing...

If you try to do it the way you described yourself. The Twitter API returns the followers in order of "newer follower first", so on the first hit (a follower listed in your stored version of the list) you can stop looking for new followers.

To1ne
  • 1,108
  • 2
  • 12
  • 22
0

I have recently started using Zapier for this.

They have a Zap which uses the Twitter API to get new followers (of you or any username that you wish monitor). The Zap monitors for new followers and can then add a record to Google Sheets, Trello, Slack etc.

It doesn't tell you who has unfollowed but you can always clash your follow lists with that of you full list.

It also triggers on a follow - so someone could follow, unfollow and follow again and appear on the list twice. Easy to manage though if you have your follower list.

Here is there documentation for this: https://zapier.com/zapbook/zaps/201/log-new-twitter-followers-google-spreadsheet/

OsulliP
  • 105
  • 1
  • 5
0

For authorized users you can use Twitter Stream API for track new followers: https://dev.twitter.com/streaming/overview/messages-types#Events_event

I use it with C# library https://github.com/linvi/tweetinvi and code is very simple:

Auth.SetUserCredentials("CONSUMER_KEY", "CONSUMER_SECRET", "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET");
var stream = Stream.CreateUserStream();
stream.FollowedByUser += (sender, args) =>
{
    Console.WriteLine("You have been followed by " + args.User);
};
stream.StartStream();
razon
  • 3,882
  • 2
  • 33
  • 46