douyi4991 2019-02-21 13:12
浏览 36

Facebook Graph API在我的商家页面上回复评论

I have these permissions for my FB App.

`email`
`default`
`publish_pages`
`manage_pages`

I was able to fetch the reviews on my Business Page through the graph API. I am stuck in finding out how to reply to a review using the API. Suppose Person A reviewed my Business page and left a review. So I want to reply to Person As review through API. I have tried the following but none of them is working.

CURL method:

$chu = curl_init();
curl_setopt($chu, CURLOPT_URL, "https://graph.facebook.com/v3.2/{fb_user_id}_{fb_comment_id}/comments?message=Thanks!!&access_token={access_token}");
curl_setopt($chu, CURLOPT_RETURNTRANSFER, true);
curl_setopt($chu, CURLOPT_POST, 1);
curl_setopt($chu, CURLOPT_TIMEOUT, 50);
$resultu = curl_exec($chu);
curl_close($chu);
$resultu = json_decode($resultu);
echo "<pre>";
print_r($resultu);

Also I have tried Graph API method:

include $_SERVER['DOCUMENT_ROOT']."/manager/include/contact-header.php";
require_once CORE_PATH.'manager/all_apis/php-graph-sdk/src/Facebook/autoload.php';
$fb = new Facebook\Facebook([
    'app_id'                => FB_APP_ID,
    'app_secret'            => FB_APP_SECRET,
    'default_graph_version' => FB_APP_API_VERSION,
]);
try {
  $response = $fb->post(
    '/{fb_user_id}_{fb_comment_id}/comments', // user_id is the ID of the user who made the page
    array (
      'message' => 'This is a test comment',
    ),
    '{access_token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
echo "<pre>";
print_r($graphNode);

None of the above is working. I get the following error.

stdClass Object
(
    [error] => stdClass Object
        (
            [message] => (#200) You do not have sufficient permissions to perform this action
            [type] => OAuthException
            [code] => 200
            [fbtrace_id] => HvneY0sxX69
        )

)

Can someone please guide me?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计