javascriptfacebookfacebook-graph-apifacebook-javascript-sdk

How can I retrive facebook comments commented on my website?


I am using Facebook comments on my website but is there any way to get the comments of my website post.


Solution

  • You can retrieve facebook comments for your URL trough the Graph API. Simply make an HTTP GET request to:

    In the following example replace <Your token> with your access token

    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", "https://graph.facebook.com/v2.6/?fields=og_object{comments}&id=https://stackoverflow.com/&access_token=<Your token>", false );
    xmlHttp.send( null );
    console.log(xmlHttp.responseText);