邀请Facebook上的朋友在网站上 [英] Invite facebook friends on a website
问题描述
我需要的功能是在自定义设计的网站页面上向用户显示Facebook的朋友列表,用户可以选择其中一些并发送邀请。
The functionality that I need is to show a list of Facebook friends to user on the website page with custom design, where user can select some of them and send invites.
在API v2.0中,可以通过以下方式获取一个朋友列表:
In API v2.0 it's possible to get a list of friends in the next way:
FB.api('/me/taggable_friends', function (response) {
...
});
但是,它不会返回真实用户的id,我需要使用下一个函数调用邀请:
But it doesn't return real users' id that I need for invites with the next function call:
FB.ui({
method: 'apprequests',
message: invite_text,
to: 'user_id_1, user_id_2'
}, function (response) {
...
}
);
如何获取这些真实的ID?
或者以另一种方式解决这个功能。因为我发现的所有答案都与不符合我的游戏相关联。
How can I get these real ids? Or how resolve this functionality in another way. Because all the answers that I found were connected with games that doesn't fit me.
我需要完整的朋友列表。不只是已经使用我的网站(游戏部分的invitable_friends模拟)。
I need full list of friends. Not just that already use my website (analogue of invitable_friends in game section).
推荐答案
您不能使用 taggable_friends
为邀请他们,显然这是TAGGING的朋友,你只会得到一个标记令牌。
You are not allowed to use taggable_friends
for inviting them, obviously it is for TAGGING friends and you only get a tagging token.
有 invitable_friends
,但是:
invitable_friends API仅适用于具有Facebook Canvas应用程序实现的游戏使用Graph API 2.0版。
The invitable_friends API is only available for games that have a Facebook Canvas app implementation using version 2.0 of the Graph API.
(https://developers.facebook.com/docs/games/invitable-friends/v2.1 )
恐怕你想要实现的是不可能的。邀请朋友到您的网站的正确方法是使用发送对话框: https://developers.facebook。 com / docs / sharing / reference / send-dialog
I am afraid what you want to achieve is not possible. The proper way to invite friends to your website is to use the Send Dialog: https://developers.facebook.com/docs/sharing/reference/send-dialog
您可以在to参数中包含一个用户ID。当然,这也是一个授权您的应用程序的用户,您可以使用 / me / friends
获得这些用户。或者更好:只需打开对话框,让用户自己选择。
You can include one User ID in the "to" parameter. Of course it must be a User who authorized your App too, you can get those with /me/friends
. Or better: Just open the Dialog and let the User select on his own.
这篇关于邀请Facebook上的朋友在网站上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!