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?