Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get (Identify) Replies to Comments Using the Graph API

With the new "Reply" to "Comments" feature on Facebook, I've noticed that replies to comments are treated the same as comments. But I was wondering if there is anyway to distinguish the two?

like image 234
Roozbeh15 Avatar asked Apr 03 '13 18:04

Roozbeh15


2 Answers

You first have to enable July Breaking Changes from your app advanced settings

Then use the fields parameter with the comments graph API and include the parent.field(id) column with the and also the filter parameter with the stream value. the final result :

{POST_ID}/comments?filter=stream&fields=parent.fields(id),message,from,likes

this should return both comments and replies with the parent element which has the comment id that the reply belongs to

-- update

and for better array arrangement for replies you can use the following to merge replies with the actual comment array you can include comments.summary(true) in the fields parameter

{POST_ID}/comments?limit=0&filter=toplevel&fields=comments.summary(true),message,from,likes

filter parameter is optional

for more info about the fields : http://developers.facebook.com/docs/reference/api/Comment/

and in case you want to do it in FQL, check this post's comments http://developers.facebook.com/blog/post/2013/04/03/new-apis-for-comment-replies/

like image 126
Osa Avatar answered Oct 05 '22 21:10

Osa


Yes. You can query each comment object in the Graph API for the value of its parent field. If the comment in question is a reply, then the value of the parent field will be a reference to the parent comment. Otherwise, no value is returned.

Reference here: https://developers.facebook.com/docs/reference/api/Comment/

like image 24
Cormac Driver Avatar answered Oct 05 '22 19:10

Cormac Driver