Sending an App Generated Request with the JavaScript SDK

廉价感情. 提交于 2020-01-05 07:35:53

问题


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?

来源:https://stackoverflow.com/questions/7496981/sending-an-app-generated-request-with-the-javascript-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!