Twitter API Logic - Need help getting all the likes by others that happen on my account for either a 12hr or 24hr current period


How to capture all likes by other people for all previous tweets. Where the likes for those tweets happen during the last 12 hrs. On my account?

Much like the Twitter notification page does? No matter how old the tweet happens to be, if someone likes it during that time period, it is displayed as liked on the notification page.

I’d use a PHP lib for Oauth, Cron etc… Easily enough.

But I’m having trouble with the Twitter API/logic to get all the likes by others that happen on my account for either a 12hr or 24hr current period.

I’m a bit new to the Twitter API.


You’ll need to set up your User Stream:

And monitor for favorite events (the API still calls likes favorites) - just remember that when you “Like” a tweet it’ll show up in that stream too.

Unfortunately you can’t go back in time and grab events from the past, so you’ll need to open up the stream, and run it for 12 or 24 hours and capture events as they happen.


Hi! First off huge thanks for the point in the right direction! Very much appreciated!

Was racking my brain. So knowing is a huge help. Thank you!

I can use the same event notifications for follows it looks like. How about mentions and retweets?

I’d basically like to keep a running info of all the external interactions/notifications for my account, much like the notifications page locally, so that I can in return like, follow, retweet, mention etc…in return, those that do for me. If that makes any sense. While managing/seeing them all in case there are some that I don’t want to.

Is there a best case Twitter API usage/code/scenario for doing this?

Thanks again, and to all!

Note: Seems sort of inefficient/wasteful of Twitter though to open up a real time event connection stream rather than just letting me grab the last so many likes for a period. Since I’m guessing they have to keep that info with a time stamp for the notification page, we all call.

With that said I guess I can’t change them. =)


Best practices with this is to use the streaming API (it’s the only way to get certain things like favourite events) and responding to people manually (Tweetdeck is good for this). Also check out for more data - there’s no API for that, but you can periodically export CSVs with engagement stats.

There are a lot of automation rules to keep in mind if you want to automatically reply, like, follow back etc: Have a read through:

The best way to do it is to limit automated interactions to a minimum, or none at all. Avoid auto-reply or auto-retweet tweets, auto-DMs that say “thanks for the follow” etc - those are all awful. (that’s my opinion, but i’ve yet to see someone react positively to an auto DM that says “thanks for the follow” or something else similar)


Agreed. No automation for me. =) I delete automated DMs, tweets etc… It’s just that my twitter page now gets around 2 million+ dynamic impressions in 28 days. So it’s getting too large for me to handle using the notifications/notifications page etc…

And notifications roll off the system so fast now, I just can’t keep up. At least not if I want to sleep. =)))

So I need a system to allow me to capture what I want and then follow up in my time. That keeps capturing, if I take a day off and will filter exactly what i want, to save time.

I use Buffer for pre-writing scheduled tweets and Manageflitter for unfollows when I need to. But trying Tweetdeck, Manageflitter and a bunch of the other management tools, they don’t seem to have the data filtering I want to see. To make things easy.

I’d like to filter all likes/retweets/mentions for each 12 to 24 hrs by if that person follows me/doesn’t follow me etc…

Just stuff like that. I want to dig in a bit on the data and remove the stuff I don’t want, only show what I want, plus be able to work on it.

So example: Let’s say a person likes a tweet I write, I’d like to be able to bring up their twitter page to see if I’d like to follow them. They may be people I’m interested in. In this instance, before I do, I’d like the system to automatically filter and only display people that i don’t already follow.

Just things like that where the computer can do the filtering upfront for me to save me time/effort.

Hope this makes sense, Cheers!


Sounds like everything you want to do is definitely possible - the user Stream will send a “friends list” (people you already follow) when it starts up: but if you want to get a fresh list of user ids you are already following you can use

Another thing that might be useful in this case might be - once you have a list of candidate users you’re interested in, filtered to exclude ones you’re already following, you can use the lookup endpoint on those ids - maybe descriptions of users will be useful for filtering people you’re interested in.