I am trying to delete an application notification on application load.
So when I invite my friend he gets a notification and requests “ok” and if he clicks on it then it should be deleted. How? I have tried multiple ways but haven’t succeeded.
$REQIDs=$_REQUEST['request_ids'];
$user_profile = $facebook->api('/me');
$token_url = "https://graph.facebook.com/oauth/access_token?client_id=XXXXXXXX&client_secret=XXXXXXX&grant_type=client_credentials";
$access_token = file_get_contents($token_url);
if($REQIDs){
$requests = explode(',',$REQIDs);
foreach($requests as $request_id){
$deleted = file_get_contents("https://graph.facebook.com/$request_id?$access_token&method=delete");
//not working ->> {"error":{"type":"GraphMethodException","message":"Unsupported delete request."}}
$deleted = file_get_contents("https://graph.facebook.com/".$user_profile['id']."_".$request_id."?".$access_token);
//not working ->> false
$deleted = $facebook->api($request_id."?".$access_token, "DELETE");
//not working ->> Fatal error: Uncaught GraphMethodException: Unsupported delete request.
}
}
Anyone have some ideas or see the error?
Take a look at this topic here >>> Topic. It explains pretty fully how to handle apprequests.
Your code should look like this:
This is supposed to do the work.
Good luck!