Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get wall posts made through my Facebook application using FB's API

I made a Facebook Application that people use to share links from my webpage to their walls, and now I need to get back a list of the posts made through it during a pediod of time (e.g. from Sep. 4th to Sep. 10th), incluiding their Post IDs.

I am aware that I could save that information at the moment of its publication, but I need some old data that I didn't save that way.

I have tried using FQL, but that requieres to indicate the source_id (Facebook ID of the user's wall where the post is on), which I am not able to know.

The Graph API object for my application doesn't seem to help either, since it doesn't have a connection for the posts made through it.

Any help would be really apreciated, even just a sign in the right direction.

like image 519
rodrigo.garcia Avatar asked Nov 04 '22 14:11

rodrigo.garcia


1 Answers

As suggested, prompt the user for read_stream permissions, and then I'd suggest to take the fql route:

 SELECT post_id, actor_id, target_id, message 
 FROM stream 
 WHERE attribution=[your app name] 
       AND created_time > [since]
       AND created_time < [until] 
       AND filter_key in (SELECT filter_key 
                          FROM stream_filter 
                          WHERE uid=me() AND type='newsfeed')

It's not likely to be an issue, but be aware that there's a limit in the number of items returned, so if your time span is wide and your users posted a lot, you may have to play with the [until] and [since] a bit more and make several calls to retrieve everything.

Also take a look at the documentation for more information about fields you can query: http://developers.facebook.com/docs/reference/fql/stream/

like image 51
Joel Cheuoua Avatar answered Nov 15 '22 12:11

Joel Cheuoua