1

I got the comments list from the feed, but I could not get their user name and avatar, I used the graph explorer and there were no fields to retrieve the user information that was commented.

I tried, but it does not work. {page_id}/feed?fields=id,comments{id,message,created_time}

Comment Id also doesn't support getting user information. 448052816017010_448055412683417/?fields=message

// My result

    "data": [
      {
        "id": "448052816017010_448055412683417",
        "message": "TYM TYM",
        "created_time": "2019-06-24T07:20:22+0000"
      }
    ] ...

Is there a way to get user or user id, or do I need to grant any permissions?

andyrandy
  • 72,880
  • 8
  • 113
  • 130
newsshare24h
  • 69
  • 1
  • 11

1 Answers1

0

https://developers.facebook.com/docs/graph-api/reference/v3.3/comment

You need to ask for the correct field. id is just the id of the comment itself, not the id of the user. from would be the correct field. You have to use a Page Token of that Page, and i believe the App has to be live:

{page_id}/feed?fields=id,comments{id,message,created_time,from}

See this for additional information: Graph API: Cannot get "from" field in comment

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • Thank you for help, I certainly used the page access tooken, and used the "from" field, but this field was not included in the result, is there any other case? – newsshare24h Jul 02 '19 at 07:43
  • is your app live? check out some other threads about the issue, there are many stackoverflow threads about it already. i believe you can only get the from field under specific circumstances now, for privacy reasons. – andyrandy Jul 02 '19 at 11:35
  • Thank you again, I did, had a stupid mistake of mine – newsshare24h Jul 03 '19 at 01:18
  • what mistake exactly? – andyrandy Jul 03 '19 at 06:16
  • I got the desired fields, just because of javascript. And Luschn, do you have any method to sort the response according (asc, desc) by create_time ({conversation_id}/message?fields=create_time), I'm having trouble with the conversation arrangement. – newsshare24h Jul 04 '19 at 02:45
  • you would have to do that on your own, with the `.sort` function of javascript, for example. – andyrandy Jul 04 '19 at 06:54
  • still not sure what you mean with the "mistake". did you solve it? how exactly? i would edit it into my answer, so others can learn something from it. – andyrandy Jul 04 '19 at 06:55
  • sory luschn, I just had a trip so now answer you, I didn't call "from" in FB.api request url, I was absent-minded. but I have found an error, in the data has been return, there are lines with field "from" ("id" and "name") as expected, but there are lines without field "from" there, I deleted the limits in settings page (country, age, etc..) but it still doesn't work – newsshare24h Jul 05 '19 at 07:30
  • some users may have disabled the platform, so you cannot get their data – andyrandy Jul 05 '19 at 07:52
  • Thank you very much for your help, I will find a solution to this problem, wish you a great day. – newsshare24h Jul 05 '19 at 07:59
  • I'm following FB documentation(https://developers.facebook.com/docs/graph-api/reference/v8.0/comment) and using Graph API v8.0. I have page access token with required permissions. I am able to get the list of comments but it doesn't show anything for the from field. Any suggestion on this. Thanks – Prajwol Aug 21 '20 at 09:29
  • is your app live and approved by facebook? – andyrandy Aug 21 '20 at 09:50