Manish Basdeo
Manish Basdeo

Reputation: 6269

How do I check if a user has accepted my application request in facebook?

I send my app request using the following method

function sendRequest() {
    FB.ui({method: 'apprequests',
           message: 'You have received a pretty image from a friend.',
           data: 'some tracking info',
           title: 'Select friends to send your image to.'}, function (response) {

        if (response && response.request_ids) {

$(function(){
              //get friends who accepted the request

        } else {

               //Do something if they don't send it.

                }
    })
}

However, I have no idea how to check if any friends have accepted the request ? Any idea how to do that? I also want to get a notification when a user accepts the request ...How do I achieve that?

Upvotes: 0

Views: 756

Answers (1)

Brent Baisley
Brent Baisley

Reputation: 12721

You need to save the response.request_ids and then you can use open graph to query information on those requests. Get an access/auth token using app login, then query the graph api:

https://graph.facebook.com/[request_id]?access_token=[token]

But even without doing that, you should just be recording that the user responded when they click on the "invite". Facebook passes a request_ids parameter in the URL. You should check for that when a user comes to your app. Then you can update your information that the user responded to the request.

Upvotes: 3

Related Questions