Facebook send application invite to random user in my Friends list

1.1k views Asked by At

I want to send my Application invites to multiple random people in my friends list just as its done in majority of application. For Instance enter image description here

As soon as i Accept the application this pop up appears.What i cannot understand is how to get the ID's of these users ? On the Client Side ?

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:fb="https://www.facebook.com/2008/fbml">
  <head>
    <title>Request Example</title>
  </head>

  <body>
    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <p>
      <input type="button"
        onclick="sendRequestToRecipients(); return false;"
        value="Send Request to Users Directly"
      />
      <input type="text" value="User ID" name="user_ids" />
      </p>
    <p>
    <input type="button"
      onclick="sendRequestViaMultiFriendSelector(); return false;"
      value="Send Request to Many Users with MFS"
    />
    </p>

    <script>
      FB.init({
        appId  : '423165827708510',
        frictionlessRequests: true,
      });

      function sendRequestToRecipients() {
        var user_ids = document.getElementsByName("user_ids")[0].value;
        FB.ui({method: 'apprequests',
          message: 'My Great Request',
          to: user_ids,                        ///  How to Fill the ID's HERE ?
        }, requestCallback);
      }

      function sendRequestViaMultiFriendSelector() {
        FB.ui({method: 'apprequests',
          message: 'My Great Request'
        }, requestCallback);
      }

      function requestCallback(response) {
        // Handle callback here
      }
    </script>
  </body>
</html>
1

There are 1 answers

9
Igy On BEST ANSWER

Why would you want to send to random users? That doesn't make any sense - surely you'd invite the people you think will like the game?!

Confusion aside, to answer your question, the 'to' parameter is either an array, or a comma seperated list of user IDs.

Here's an example of CSV, taken from the documentation:

function sendRequestToRecipients() {
  FB.ui({method: 'apprequests',
    message: 'My Great Request',
    to: '499802820,499802852'
  }, requestCallback);
}