Facebook New API for Monitoring comment Replies

Facebook Comments API
As you might have noticed, Facebook introduced threaded comments to posts on Fan Pages. And I must say, it was a long-awaited and much-needed feature indeed. It made conversations much more organized, and readable. But what if you wanted to integrate this functionality, and fetch & deliver comments and their replies from your page onto your website? If you're a developer, you'd know that you need an API for this sort of work. Fortunately, you are in luck, because Facebook just rolled out  a new update for its API for comments and replies on Facebook pages. Using this, you can monitor and respond to comments and replies on your Page.

Updates to the API

This update comments API now provides developers with different 'views' of the comments on your page. There are three basic views; Top Level Comments, Replies and Comment Streams. These views can be accessed by the Graph API as well as through Facebook's FQL table.

Threaded Comments

Top Level comments - These are individual comments to the post itself, and not replied to any comment. This view is called "top level". The comments in this view might be ranked on the basis of their quality, replies, and some other factors.

Replies - This view, called "replies" fetches replies to an individual comment of a post.

Comment Streams - "stream" will return all top level comments and their replies in a chronological order, so the top level comments here won't be ranked.

FQL Commands

You can get data using both FQL ad Graph API. If you're using existing API, you need to keep in mind that the 'comments' column in the 'stream' FQL table has been depreciated. Instead, use 'comment_info' field to fetch data from 'can_comments' and 'comment_count' fields. Here are the FQL queries for the three views.

Top Level comments

SELECT id, fromid, time, text, likes
FROM comment
WHERE object_id={object_id} AND parent_id='0'

Replies

SELECT id, fromid, time, text, likes
FROM comment
WHERE parent_id={comment_id}

Comment streams

SELECT id, fromid, time, text, likes
FROM comment
WHERE object_id={object_id}
ORDER BY time
(almost exactly the same as Top level Comments query, but ordered by time, and no check for parent_id being 0;

Missing out on something?

If you're wondering why you don't see threaded comments on your Facebook Fan Page, then that's because Threaded comments have only been enabled for popular pages with a lot of fans (1,000+). If you're not quite there yet, then don't worry. This option will be turned on by default for all pages by June 10.

Do you like the new changes? You can read the Facebook Developers Blog for more information, or check out the documentation for this API for detailed instructions. You can also ask us questions in the comments below. Stay tuned :)

If you don't want to get yourself into Serious Technical Trouble while editing your Blog Template then just sit back and relax and let us do the Job for you at a fairly reasonable cost. Submit your order details by Clicking Here »