user875330
user875330

Reputation: 23

Invite Facebook friends to use app from Objective C or PHP

I know this question has been asked before, but most of the questions are years old, so maybe Facebook has made available some new api calls.

My question is if its possible (with permissions from Facebook) for one user to invite friends to use a Facebook app through code. Alternatively (second best option) pre fill the required Facebook modal view with friends a user want to invite.

The reason we want to invite friends through code is because we are creating an event app where users can invite friends via contacts from their device or Facebook, and we want to present the user with one contact list where all friends are located (both local contacts and Facebook contacts). When the user has filled out who he/she wants to invite we want to seamlessly invite people both on email and Facebook without the user getting bothered with details (extra views) about how its done.

When user answers yes to the app invitation they are directed to a page where they can answer yes/no to the event.

Upvotes: 0

Views: 1007

Answers (2)

dadederk
dadederk

Reputation: 335

Facebook has changed lately its policy about getting a list of your friends so you only can get the friends that already have the same app installed, the invitable friends (only for games) and the taggable friends (only for tagging friends on pictures or posts). The best way to invite friends that I found is using the FBWebDialogs. They call it a request. You can specify some users with adding the "to" parameter to parameters (which is a NSDictionary) or redirect to another page, when the user selects de request, using the "redirect_uri" parameter.

[FBWebDialogs
     presentRequestsDialogModallyWithSession:nil
     message:@"Join me to this awesome app!"
     title:@"myApp"
     parameters:nil
     handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {

     }
];

You can find the documentation here: https://developers.facebook.com/docs/reference/ios/current/class/FBWebDialogs/

More information here: https://developers.facebook.com/docs/games/requests/v2.1

Hope it helps and that it's enough for what you are asking to do.

Upvotes: 3

andyrandy
andyrandy

Reputation: 73984

It is only possible for games on facebook.com, see Facebook docs for more information: https://developers.facebook.com/docs/games/requests/v2.1

Check out "invitable_friends" too, it´s available for games only too: https://developers.facebook.com/docs/graph-api/reference/v2.1/user/invitable_friends

Upvotes: 0

Related Questions