Send Facebook App Request/Invite using Graph Api

最后都变了- 提交于 2019-12-04 11:30:19

Sending Facebook app requests are not available via the graph api. You can use the app requests javascript dialog to send the request though, you would just need to specify the user's id in the "to" property as detailed in the documentation.

Sample function:

<script>
  FB.init({ appId: '**appId**', status: true, cookie: true, xfbml : true });

  function sendRequest(to) {
    FB.ui({method: 'apprequests', to: to, message: 'You should learn more about this awesome site.', data: 'tracking information for the user'});
    return false;
  }
</script>

Then just wire an onclick for each image to something like onclick="return sendRequest('**friendId**');"

I had same problem. Though it is very late for answering question, it will help somebody. That's why answering this question.

Instead you can call this function in javascript: it will give you all friends with photos. Also group of friends who are currently using same app. You can send request to any of them.

function sendRequestViaMultiFriendSelector() {
    FB.ui({
        method: 'apprequests',
        message: "You should learn more about this awesome site."
    });     
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!