Is there a way for users of my website to invite their friends via Facebook Connect or the API?
Working with the Facebook API makes my ears bleed, but nonetheless I've got a specific problem here which I'm hoping someone can find a solution for. I'm using the Facebook PHP SDK to allow users of my website to link their FB account with their website account, so they can return later and log in with one click (by storing their OAuth tokens in my database). This is all working fine - what I now want is to be able to provide users with the facility to invite/recommend their friends to my site, using a form on my site.
I've tried FBML examples from many places including here - I've managed to get an invitation form to display but try as I might, all I can get it to generate is an invitation to my application, which isn't relevant. The app exists only so that I have an OAuth ID/secret to use with the Graph API. I want to invite the user's friends to my website, or at the very least to a Facebook Page plugging my website. But seemingly including this FBML on my page will only generate application invites.
My question: is there any way to accomplish this?开发者_如何学运维 Can I invite the user's friends to my site (ie. to a specific URL), or invite them to my FB Page? Am I approaching this from the wrong angle?
Any advice would be much appreciated. If you'd benefit from any further info, please let me know. Many thanks,
Biggs
Right. It turns out after much tearing of hair, the example I gave was the right one. The invite generates an "Application Invite", but this is not like other app invites. When the recipient clicks "Accept" they are sent to the URL you specify (in this case, my website). The "App" then disappears from their request page - it does not appear in their profile like a normal app. So a horribly nonsensical process but a positive outcome. Phew!
It seems like sending a Facebook message is the way to go at this point (Jan 2013).
https://developers.facebook.com/docs/reference/dialogs/send/
In general, applications on Facebook should use Requests when communicating in game status (its your turn), inviting people to use an application, or sending messages to multiple people.
FB.init({appId: 'YOUR_APP_ID', xfbml: true, cookie: true});
FB.ui({
method: 'send',
name: 'Check out this site!',
description: 'This is the best site ever!',
link: 'http://www.example.com/refer',
picture: 'http://www.example.com/image.jpg'
});
Why not go for this open source inviter which can get your work done quick . also if you are using a cms they might have already made the plugin for your cms. http://openinviter.com/
精彩评论