1

I am trying to send an app-generated request using the JavaScript SDK, following the PHP example here https://developers.facebook.com/blog/post/464.

I've tried this way:

FB.api( "/" + recipient + "/apprequests", "POST", {
    message: "Notification Message",
    data: "Notification data"
}, function( response ) {
    console.log( response );
} );

Where 'recipient' is the id of the user who should receive the request.

The above code worked only when sending request to the user that is currently logged in.

When sending a request to another user (who is connected to the app), the FB.api call returned the following error:

{
    "message": "(#2) User can't send this request: Unknown error",
    "type":"OAuthException"
}

Is it possible to send app-generated requests using the JavaScript SDK and if so, what is the correct way to do it?

pm_
  • 853
  • 6
  • 15
  • 1
    To send an app-generated request an app access token is required so it seems like the only way of doing this is server-side. – pm_ Oct 25 '11 at 14:02
  • Please see http://facebook.stackoverflow.com/questions/7671666/sending-request-2-0-app-generated-request-to-other-than-me/8295593#8295593 – Alexcode Nov 28 '11 at 12:21

0 Answers0