1 year ago

#121806

test-img

Keyvan

facebook Unsupported post request. Object with ID 'me' does not exist, cannot be loaded due to

I try to send respond message on facebook as response

    $replay_message = '{
    "messaging_type": "RESPONSE",
    "recipient": {
      "id": "'.$id.'"
    },
    "message": {
      "text": "Hello , We are Offline now! We will sent replay to : '.$messasge.'"
    }
}';

send_replay($access_token , $replay_message);

function send_replay($access_token = "" , $replay = "")
{
    $url = "https://graph.facebook.com/v6.0/me/messages?access_token=".$access_token;
    $ch = curl_init();
    $headers = array('Content-Type: application/json');
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $replay);
    $output = curl_exec($ch);
    $result = json_decode($output , true);
    file_put_contents('text.txt' , $output);
    return $result;
}

when i get token from developer.facebook.com is work fine but from login with this request :

email,public_profile,pages_messaging,pages_manage_metadata,pages_show_list,ads_management

give me this :

   "error":{
  "message":"Unsupported post request. Object with ID 'me' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api",
  "type":"GraphMethodException",
  "code":100,
  "error_subcode":33,
  "fbtrace_id":"AxJcSLQzHGkf0-FecpYMa7O"

}

facebook

facebook-php-sdk

0 Answers

Your Answer

Accepted video resources