如何以编程方式邀请网站上的Facebook朋友 [英] How to programmatically invite Facebook friends on a website
问题描述
我需要的功能是使用自定义设计在网站页面上向用户显示Facebook朋友列表,用户可以在其中选择其中一些并发送邀请.
The functionality that I need is to show a list of Facebook friends to the user on the website page with custom design, where the 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 this 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 to resolve this functionality in another way? Because all the answers that I found were connected with games that don't fit me.
我需要完整的朋友列表.不仅已经使用了我的网站(invitable_friends
游戏内部分的类似内容).
I need a full list of friends. Not just that already use my website (analog of the 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仅适用于使用Graph API 2.0版实现Facebook Canvas应用的游戏.
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
您可以在至"参数中包含一个用户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屋!