FaceBook API: Get the Request Object for a request Id - logged into the account that sent the request. Using the "Requests Dialog" API

13,083

Solution 1

I've been asking myself this question a while ago:
How to retrieve all the requests sent by me?

The answer: you can't!
You have two options:

  1. Store the request_id returned when the user sent the request, so you can later access them and get the data you need
  2. Knowing the receiver!

Proof of the above, you can check the friend_request table. The indexable field is the uid_to field!

Solution 2

This is if you want it in know Iframe mode as you don't need Iframe mode any more

function sendRequest() {
        FB.ui({                    
            method: 'apprequests',
            title: 'Invite friends to join you',
            message: 'Come play with me.'
            },
            function (res) {
                if (res && res.request_ids) {
                    var requests = res.request_ids.join(',');
                    $.post('FBRequest.ashx',
                        { request_ids: requests },
                        function (resp) { });                    
                }
            });
        return false;
    }
Share:
13,083
ak7
Author by

ak7

Updated on June 16, 2022

Comments

  • ak7
    ak7 almost 2 years

    I am using the "Requests Dialog" to create Facebook requests. Inorder to get the user that the requests were sent to I need to access the Request object using the graph API. I have tried most of the permissions settings that seemed appropriate (read_requests and user_about_me) to get the request object, but instead I get a false in the response. Am I using the wrong permissions?

    I am able to access the request object using the graph API from the account that the request was sent to.

    http://developers.facebook.com/docs/reference/dialogs/requests/

    Return Data - A comma-separated list of the request_ids that were created. To learn who the requests were sent to, you should loop through the information for each request object identified by a request id.