I've got the following Javascript code:
function RemoveRequest( requestToRemove )
{
FB.api( requestToRemove, 'delete', function(response) {
console.log(response);
});
}
This seems to be the standard approach I see people using. Unfortunately, I get an error. The response object I get from this states the following: "App Request Recipient Must Be Specified: The recipient for this app request must be specified through a user-signed access token or the fully specified app request ID."
So, I try using requestid_facebookid instead... no luck. I try passing in my access token via
FB.api(requestToRemove, 'delete', {access_token:accessToken}, function(response) {
console.log(response);
});
Both give me the same error.
Any tips would be greatly appreciated.
Edit: Just for clarity's sake, the authToken I am getting is from response.authResponse.accessToken from getLoginStatus.
I'm still not sure how to delete these requests. However, I did come up with a workaround with the graph api.
New code is as follows:
Sending the app request
var params = {};
params['message'] = 'My message!';
params['title'] = 'My title!';
params['to'] = inID;
params['access_token'] = accessToken;
FB.api('/me/apprequests', 'POST', params,
function(response){
if( response )
{
console.log( response );
}
});
And deleting it
function RemoveRequest( requestToRemoveID, facebookUserID )
{
requestToRemoveID = '/'+requestToRemoveID + '_' + facebookUserID;
console.log( requestToRemoveID );
FB.api( requestToRemoveID, 'DELETE', function(response) {
console.log(response);
});
}
This seemed to change the type of the request from a user app request to an app request. The logo changed from my profile picture to the app icon. I was able to delete these requests both from the graph api and through facebooks webpage. I'd still love to know how to delete the user app requests if anyone has any ideas.