开发者

How to create requests dialog with multiple recipients selected by app

The Sims Social has their own friend selector. And once you select your friends and hit submit, it throws up this official Facebook request dialog that has multiple friends on it 开发者_高级运维and a checkbox that says "Don't ask before sending The Sims Social requests to..."

How can I duplicate this? I've tried sending an array to the apprequests ui dialog, but that gives "Error Message: Too many recipients."

How to create requests dialog with multiple recipients selected by app

I'm not using the Facebook friend selector. I'm using my own and sending it to the apprequests dialog. The Sims does this, I just can't reproduce it.

FB.ui({
    method: 'apprequests',
    message: 'Send a gift',
    data: {},
    title: "Send a gift",
    to: uids[0] + "," + uids[1]
});

I've tried the to field with a string list, "1234,4567". I've tried it with an array { 1234, 4567 }. But neither works. An array with a single UID works fine. But multiple UIDs gives "Error Message: Too many recipients."


As per the Facebook documentation (which admittedly isn't very good), you can pass a JavaScript array, [], in the to attribute. It looks like uids is already an array, so try this:

FB.ui({
    method: 'apprequests',
    message: 'Send a gift',
    data: {},
    title: "Send a gift",
    to: uids
});


My guess is that you need to be whitelisted by Facebook to get this sort of super power. The Sims Social are using the same parameters as you do but have the ability to specify multiple recipients. You should ask Facebook to do the same for your app.


You can do this with the Requests Dialog - https://developers.facebook.com/docs/reference/dialogs/requests/

You can have up to 50 recipients per request (some restrictions on IE, as mentioned in the doc).

With multiple IDs, you can specify the recipients in the 'to' parameter as a JavaScript array, e.g. 'to: [1,2,3]'


According to the Improvements to Request 2.0 thread posted September 29, 2011

You can specify an array of user_ids in the ‘to’ field of the request dialog.

  function sendRequestToManyRecipients() {
    var user_ids = document.getElementsByName("user_ids")[0].value;
    FB.ui({method: 'apprequests',
      message: 'My Great Request',
      to: user_ids,
    }, requestCallback);
  }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜