Facebook Requests ID(s) retrieve and delete

2019-06-07 21:58发布

So I'm developing a small web app, that implements the Requests Dialog(User-to-User).

I'm able to send an invite and also successfully to save data as request id and user id. But when the user gets redirected to my app, after clicking on the request, i can't retrieve request id as shown here: https://developers.facebook.com/docs/requests/#deleting and then delete it.

But i see the request id in the address bar of the browser and it looks like this: http://apps.facebook.com/myownapp/?fb_source=request&request_ids=210655195715938 and REQUEST_URI is: /halten/?fb_source=request&request_ids=210655195715938

i tried with javascript:

function getMultipleRequests(requestIds) {
    FB.api('', {
        "ids": requestIds
    }, function(response) {
        console.log(response);
    });
}​

or with php:

if(isset($_REQUEST['request_ids'])) {
    $requestIDs = explode(',' , $_REQUEST['request_ids']);
    foreach($requestIDs as $requestID) {
      try {
        $delete_success = $facebook->api('/' . $requestID, 'DELETE');
      } catch(FacebookAPIException $e) {
        error_log($e);
      }
    }

but the request_ids is always empty but my browser shows the request_id

So the question is how to handle the problem? Thanks in advance

1条回答
干净又极端
2楼-- · 2019-06-07 22:25

A User to User Request is actually notified to the user in 4 levels.

1) Jewel notification

enter image description here

2) Bookmarks counter

enter image description here

3) Right top counter

enter image description here

4) Weird location notification inside the app(I did not know what this was called sorry)

enter image description here

All of these request will take the user to the app but unfortunately on the Jewel notification(#1) request url will contain all the request IDs and the remaining will contain only a single request ID.

Say you send 4 requests (1,2,3,4)

#1 in url will have 1&2&3&4

#2,#3,#4 will have one of those depending on which notification you response to

Hope this makes sense and answers the question.

查看更多
登录 后发表回答