How to read comments posted by users on a website using FB Social Plugin?

On one of my customer’s website we added the Social Plugins “Comments” to allow visitors to post comments about the products on sale in this website. My client would like a way to check out what people are saying about his products.
So far the only way he has is to go thru all products one by one, which is obviously not handy at all. Is there a way to do this ?

There’s a few ways to address this…

First you should be tying all of your comment blocks back to a single Facebook App ID with assigned admins [it’s also possible to just add admins without an app but that makes user management a real pain as you want to add / remove people]. This will let you get notifications and aggregate analytics around what’s happening versus just having the comment widget without anywhere for it to associate too.

Second you can use a social media management platform or build your own tool to access the Facebook API and report on new comments off of it. Obviously this requires some investment but with everything tied into an App it’s very easy to pull up the most recent comments and display links to them without anything too fancy.

Third if you want to get more sophisticated, you can update a database or do anything else you like by triggered a javascript event when a comment is left. This allows for both system updates and analytics.

Thanks Ted, I am looking into it

I have defined a Facebook Application Id and comments are showing up in the Comment Moderation Tool. Still we have to go there to see if a comment was posted or not because I haven’t found the way to automate the notification yet.

The comment box is set up that way

In the header

<meta property="fb:app_id" content="my_app_idd"/>
<meta property="fb:admins" content="101xxxxxx"/>

Before the fb comment

<script>
 window.fbAsyncInit = function() {
     FB.init({ appId: '338850122832287',
        status: true,
        cookie: true,
        xfbml: true});

    FB.Event.subscribe('comment.create',
        function(response) {

        }
    );

 };
 </script>

And the box

<fb:comments notify="true" href="http://www.xxxxx111.cl/xxxxxxx-50.aspx" num_posts="5" width="730">

You can add a handler to function(response) {} to send a notification or query the API to access recent comments.

Facebook has expanded notifications to on-page items and the timeline dashboard brings more information to the surface but honestly I’m not sure if this extends out to off-page comments. http://www.insidefacebook.com/2011/08/22/page-bookmarks-home/

Just spend a few hours diviing into the Grap API and no luck so far. At least the alert message comes up fine. See http://www.8va.cl/fb.htm

Got it working eventually. Not the way I really wanted (that is posting a message on the wall) but sending an email


 window.fbAsyncInit = function() {
     FB.init({ appId: 'YOU_APP_ID',
        status: true,
        cookie: true,
        xfbml: true});

    FB.Event.subscribe('comment.create',
        function (response) {
            console.log("comment created");
            var commentQuery = FB.Data.query("SELECT text, fromid FROM comment WHERE post_fbid='" + response.commentID +
                "' AND object_id IN (SELECT comments_fbid FROM link_stat WHERE url='" + response.href + "')");
            var userQuery = FB.Data.query("SELECT name FROM user WHERE uid in (select fromid from {0})", commentQuery);
            FB.Data.waitOn([commentQuery, userQuery], function () {
                var commentRow = commentQuery.value[0];
                var userRow = userQuery.value[0];
                /* console.log(userRow.name + " (id: " + commentRow.fromid + ") posted the comment: " + commentRow.text); */
                trackcomments(response['commentID'], response['href'], 'create', commentRow.text, userRow.name, commentRow.fromid);

            });
        });

};

function trackcomments(_commentid, _address, _action,
 _commentMessage, _userName, _userId) {
    /* Replace FBComment.aspx by any server script sending the email*/
    $.ajax({
        type: 'POST',
        url: '/FBComment.aspx',
        data:
             {
                 commentId: _commentid,
                 pageUrl: _address,
                 actionTaken: _action,
                 userName: _userName,
                 userId: _userId,
                 commentMessage: _commentMessage
             },
        error: function (jqXHR, textStatus, errorThrown) {
            console.log(errorThrown);
        },
        success: function (result) {
            console.log("successfully received callback");
        }
    });
}