Reputation: 4245
My app needs to monitor friends comment to user.I need to retrive new comments to user.I read Graph API and FQL documents and some search (including this question Can the facebook API fetch only NEW comments? still cannot figure how to achieve that.
please help.
Upvotes: 0
Views: 343
Reputation: 4245
I figured out how to write FQL for get the infomation I want.
SELECT comments,post_id,source_id ,created_time,message,action_links,attachment,permalink,description,type FROM stream WHERE source_id = me() AND comments.count>0 AND actor_id=me()
Thanks Gunnar Karlsson I get comments form user stream,and check if each stream have comment and check comments have recorded in database.
Upvotes: 0
Reputation: 28480
You can't retrieve a list of other users' comments to the current user's posts without knowing the post ids. So you can't request "Give me all comments that other users made on Peter's posts" unless you know which those posts are. This is because the "fromid" field in the FQL comments table is not indexable.
I don't know if this is relevant for your app but you can do this: retrieve the name and id of who commented on the current users wall. That is, request "Give me all names of those who commented on Peter's wall, and show me those comments as well".
The FQL call is
SELECT post_id, message, actor_id FROM stream WHERE source_id = me() AND type=56
where
"message" is the comment
"actor_id" is who posted it
"type=56" means only include posts on wall from another user.
Have a look at the FQL stream table.
Since you say your app needs to monitor the comments, you'd need to poll Facebook, or subscribe to real-time updates.
Upvotes: 1