I need to get my app to invite the currently logged in user to a specific Facebook Group. Already got all the facebook login stuff taken care of and have done other facebook.request function calls to post images to the same Facebook group for people who are already members. But I can’t for the life of me get the invite for non-members to work.
Facebook’s website about “Inviting Users” to Groups says:
“Applications can invite users to a group by issuing a POST request to /GROUP_ID/members/USER_ID with an app access_token.”
After wracking my brain figuring out how to get the *app* access_token (which is very different from the *user* access_token), I tried the following, passing the access_token in as a parameter to the facebook.request…
facebook.request( “/” … myFacebookGroupID … “/members/” … currentlyLoggedInUserID, “POST”, { access_token = myAppAccessToken } )
In, the Console in the “iPhone Configuration Utility” while connected to my device, I see the request go out and immediately get an Error return. First, the Console gives me “Error: HTTP status code: 400”, and then the response object from Facebook gives me the very cryptic “The operation couldn’t be completed. (com.facebook.sdk error 5.)” (which is the same error I get for *every* error I get from the facebook listener).
I know that HTTP error 400 means “bad request”, but it doesn’t give me any details about what’s wrong with the request.
So then I tried removing the param variable and tacking it onto the passed address instead…
facebook.request( “/” … myFacebookGroupID … “/members/” … currentlyLoggedInUserID … “?access_token=” … myAppAccessToken, “POST” )
I get the exact same error from Facebook (error 5), which tells me nothing, but the Console prints “Error: HTTP status code: 200”!!! 200?!? An HTTP code of 200 means OK! So why is it an error and why does Facebook still respond with a problem?
Any help would be appreciated!