如何使用fb.ui向多个用户发送Facebook消息

时间:2015-01-27 10:25:40

标签: facebook sendmessage fb.ui multiple-users

我想向多个用户发送Facebook消息,并在发送消息后,我希望这些用户ID来自对话框。

我搜索到只有方法发送才有可能,所以首先我使用 apprequests 方法,并且从此响应中我想将所选用户传递到Facebook发送对话框。

以下是我正在使用的代码。

FB.ui({
        method: 'apprequests',
        message: "my app request message",
        link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',   
    }, function(response) {
        if(response && response.hasOwnProperty('to')) {
            var user_ids    =   [];
            for(i = 0; i < response.to.length; i++) {
                user_ids.push(response.to[i]);
            }
            console.log(user_ids);
            fb_share(user_ids);
        }
    });


function fb_share(user_ids){
    FB.ui({
      method: 'send',
      to: user_ids, //[862579587127634, 1571716563066056],
      link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',
    });
}

但是在这种情况下,在邀请朋友之后出现“消息”对话框时,它只选择一个用户而不是多个用户。

请帮帮我们。

谢谢!

0 个答案:

没有答案