Commenting on Facebook Page Ratings (Reviews) via Graph API

风流意气都作罢 提交于 2019-12-21 09:23:12

问题


Long time lurker first time poster...

We are working with Facebooks API's to integrate into our web application and we are able to pull a Companies Page Rating via the {open_graph_story} parameter in the {page-id}/ratings section, however we cannot find a way to comment/reply to the rating. The documentation states:

"If a person has rated your page and a story has been generated, you can follow up with the person by posting to the story's comment node." (https://developers.facebook.com/docs/graph-api/reference/v2.0/page/ratings)

however when we pull the variables we retrieve no ID to reference for a comment. This is what we receive back from our authenticated account:

"data": [
{ "created_time": "2014-07-16T05:52:50+0000",
"reviewer": {
"id": "100000237096397",
"name": "Romey Salazar"
},
"rating": 5,
"review_text": "Great job guys!!!!"
} ],

Does anyone know how to retrieve the id for the rating itself so we can append a comment via API? Or some other way to reply/comment to a FB Page Rating?

Thanks!


回答1:


When you have some ratings/review comments on your page and if you want to post comment to individual review comments as the Page Owner, you can follow the steps below.

1) Below request returns the json object of rating and reviews.

https://graph.facebook.com/v2.9/{YOUR_PAGE_ID}/ratings?field=open_graph_story&access_token={YOUR_PAGE_ACCESS_TOKEN}

The response json will contain ID field for each and every rating/review comments.

2) Using the ID, trigger the below request to post a comment on the rating as the Page Owner. You will need Page access token with manage_pages and publish_pages privilege.

https://graph.facebook.com/v2.9/{ID_OF_THE_RATING}/comments?message=Thanks for your rating&access_token={YOUR_PAGE_ACCESS_TOKEN}

These requests can be tested using Facebook Graph API Explorer




回答2:


You need to request the open_graph_story field with the ratings endpoint. This will return the open_graph_story data which includes an id. You can then post to the comments endpoint of this story.




回答3:


You have to make http get request on

  1. https://graph.facebook.com/v2.9/{PageID}/ratings?fields=open_graph_story&access_token={PageAccessToken}

to get detailed response. Make sure the parameter is "fields" not "field"



来源:https://stackoverflow.com/questions/24825511/commenting-on-facebook-page-ratings-reviews-via-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!