Basically I want to display a list of friends (with pictures and names) and invite them to my app I'm creating in rails with the fb_graph
gem. The link shows the flow of how this would work, basically you would click an "Invite Friends" button and a list of friends would pop up with a button allowing you to invite the respective user.
http://www.quora.com/User-Acquisition/What-is-the-best-invite-a-friend-flow-for-mobile
Is there a way to do this with fb_graph
?
You bet. Assuming you have a working implementation of fb_graph, you can get a list of friends with the following command (from https://github.com/nov/fb_graph ):
FbGraph::User.me(fb_token).friends
You can use that to generate your UI for your friends list, then invite the selected friends, like so ( untested modification from the previous link, as well as https://developers.facebook.com/docs/reference/dialogs/requests/ ):
app_request = FbGraph::User.me(token).app_request!(
:message => 'invitation message',
:to => friend.uid
)
The previous code also can accept a comma separated collection of UIDs.
I'll leave you to design and code the UI, but it is possible, using fb_graph, for sure. Those two links should be solid gold, should you decide to expand the scope, at all.
Thanks for your interest for my gem.
Brad Werth's code works for existing (= already installed your app) users, but probably not for new users.
There are lots of limitations to send App Requests in background to avoid spamming. That limitation directly affect fb_graph's sending App Request feature.
If you are developing iOS app, I recommend you to use FB official iOS SDK. https://developers.facebook.com/docs/howtos/send-requests-using-ios-sdk/
Using iOS SDK (or JS SDK in html5 app), you have less limitations.
ps. I'm not familiar with Android App development nor FB official Android SDK, but I assume they have something similar functionality in their Android SDK too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With