最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to create requests dialog with multiple recipients selected by app - Stack Overflow

programmeradmin4浏览0评论

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."

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."

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."

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."

Share edited Aug 30, 2011 at 18:30 Mike Odie asked Aug 30, 2011 at 2:17 Mike OdieMike Odie 3423 silver badges13 bronze badges 2
  • {} represents an object literal, not an array. [] represents an array. – Intelekshual Commented Aug 31, 2011 at 23:06
  • please, can you tell me how did you send the request? – Hiyasat Commented Sep 19, 2011 at 13:07
Add a ment  | 

4 Answers 4

Reset to default 2

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./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)

  1. 暂无评论