Search code examples
facebookapprequests

facebook friend requests


I use default facebook dialog to ask for request

<script type="text/javascript"> 
function sendRequestToRandomFriends() {
  FB.ui({method: 'apprequests',
    message: '<?= na ('request text') ?>',
    to: '<? $to = '';
            foreach ($Rfriends as $c) {
              if (isset($c['uid'])) $to .= $c['uid'] . ',';
            }
            if (!empty($to)) echo substr($to, 0, -1);  ?>'
  }, requestCallback);
} 

But I saw many self created dialog windows , which ask to send requests.

How they sends requests when user press the button ?


Solution

  • I found your answer. It is buried deep down in the documentation. To send a user request without the FB.ui dialog you can use the grpah api's create user request to send.

    Create

    You can post a apprequest for a user by issuing an HTTP POST request to /USER_ID/apprequests with the app access_token.

    Note: POSTing to the Graph API endpoint of /USER_ID/apprequests is considered an App to User Request. App-Generated Requests do not receive notifications and get limited distribution in comparison to User to User Requests sent with the Request Dialog