Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get stream of new Facebook likes for your application

Is it possible to get response from Graph API (or FQL) that will list new likes for application and objects tied to it? Meaning - I created application, posted Like buttons all over the site - can I now get feed that will tell me what are the last 10 likes my pages received?

Related - can I somehow get list of last 10 likes of my Fan Page (something like New Likes box in Admin section)?

like image 365
nikib3ro Avatar asked Mar 27 '12 01:03

nikib3ro


1 Answers

There is no public Facebook API that will allow you to receive a stream of the most recent likes for a collection of objects.

Furthermore, it doesn't appear to be possible to obtain a stream of likes ordered specifically by time, however it is possible to receive a list of user IDs who liked an object using the like FQL table.

like: An FQL table that returns the IDs of users who like a given object (video, note, link, photo, or album).

For example, to retrieve a list of all the user ids who liked the 'Facebook' page, you would use the FQL query:

SELECT user_id FROM like WHERE object_id="122706168308"

Which would return a list similar to this:

<fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true">
<like>
<user_id>100003494051884</user_id>
</like>
<like>
<user_id>100003621882407</user_id>
</like>
<like>
<user_id>100003664580513</user_id>
</like>
<like>
<user_id>100002342537723</user_id>
</like>
<like>
<user_id>100001712929866</user_id>
</like>
<like>
<user_id>100003278394112</user_id>
</like>
</fql_query_response>

The order of the user IDs isn't clear - it may be in no specific order, or it may be ordered by time. I'd recommend that you have a bit of a fiddle with FQL and likes to see if it is in any particular order. You should also take a look at the other examples documented here.


As mentioned by Roni, it is possible to use the notifications RSS feed of your page to retrieve an RSS 2.0/XML feed of all notifications, sorted by time.

It may be possible to parse that XML to find the users who most recently liked your page, but the feed can get messy: it basically contains the HTML for each notification on the notifications page.

like image 68
Xenon Avatar answered Nov 06 '22 11:11

Xenon