What i want to do is get the request ID and insert to my database. My request dialog is run well, but the problem is I cannot get ‘TO’ user id http://developers.facebook.com/docs/reference/dialogs/requests/ , but I still cannot get the request user ID.
here is my coding:
function newInvite(){
//var user_ids = document.getElementsByName("user_ids")[0].value;
FB.ui({
method : 'apprequests',
title: 'X-MATCH',
message: 'Come join US now, having fun here',
},
function getMultipleRequests(requestIds) {
FB.api('', {"ids": requestIds }, function(response) {
console.log(response);
});
}
);
}
any solution on this?
million thanks for help
Have you enable request 2.0 efficient?
If you have enabled, you can get the user id easily as the response like this
In your callback function, you can use
response.requestto get the request IDresponse.toto get the array of user idsAnd notice that if you use request 2.0, the request ID format will like this
If you doesn’t enable it, then you can only get the array of request ids and you need to make another api call to get the user id
Edited:
Then you can use the array “receiverIDs” for further process
For example I sent a request to user id with id “1234”, “5678”
The response will like this:
In request 2.0, the full request id will look like this
Caution: FB doc tell you to manage and delete the request yourself, if you using request 2.0,
remember to delete the id like the above, if you directly delete the request ‘123456789’, all the full request ID with this prefix will be deleted.
==================================================================
If you haven’t enable request 2.0, follow the code on the doc page to see how to get the user id by making a api call
The response format for these methods is as follows:
you can implement the callback of api call and getting who is the receiver by
response.to.id