Inviting Users To A Facebook Group

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!

So, I’m beginning to think this isn’t possible, despite the documentation, though if someone can enlighten me otherwise, that’d be great (though I’ve been Googling for the last 2 days looking for answers).  Essentially what I was trying to do is make it so that only users of the app can become a member to our Facebook group.  To test this “Invite to Group” feature I’ve tried 2 other options outside of Corona; I’ve tried making a PHP webpage that calls the Facebook graph, and tried using Facebook’s Graph Explorer to try this out…

https://graph.facebook.com/myGroupID/members/nonMemberFBUserID?access_token=myAppsAppToken

The webpage returns an empty data object; “{“data”:[]}”.  And the Facebook Graph Explorer just lists all of the existing members along with some cryptic “paging” object with a “next” web address in it. If I go to this address directly, it says:

{ “error”: { “message”: “An access token is required to request this resource.”, “type”: “OAuthException”, “code”: 104 } }

 

But, as you can see, I passed an “access_token” variable, and does this mean the app or the user access_token? *shrug*

 

As for Corona tests, if instead of doing facebook.request, I do a network.request() POST with the above address I get an error “(#200) Requires extended permission: manage_groups”.  This might be the real meaning of the HTTP 200 I was getting above.  Adding this permission of “manage_groups” to the facebook.login() fails and returns an error.  The interesting thing is if you go to the Facebook Graph Explorer, and try to create an Access Token, there is NO option for “manage_groups”.  A few Google’s later and Facebook’s dev team says it’s not a public permission.  What the?!?

And in no case did my dummy FB email ever receive an invite by email or notification in Facebook.  So, even if all of this worked, I’m beginning to think it wouldn’t suit my purpose anyway.  I tried just doing an “Invite by Email” through Facebook’s regular UI to my dummy FB account.  When the dummy received the email to “Join the Group” it doesn’t automatically add them when they click the button; it just submits a “Request to Join”.  This defeats the purpose since it doesn’t indicate that they were invited by the app, as opposed to someone just requesting to join the group that doesn’t own the app.

 

So now I’m leaning towards having the app, after the user logs in and I determine they aren’t a member of the group, that their name and email is sent to a secure website that the moderators can check to compare against new group requests, and then we just add or deny based on that list. *shrug*

But I’d be curious to see if the Corona devs or anyone else has any more information on this.

 

So, I’m beginning to think this isn’t possible, despite the documentation, though if someone can enlighten me otherwise, that’d be great (though I’ve been Googling for the last 2 days looking for answers).  Essentially what I was trying to do is make it so that only users of the app can become a member to our Facebook group.  To test this “Invite to Group” feature I’ve tried 2 other options outside of Corona; I’ve tried making a PHP webpage that calls the Facebook graph, and tried using Facebook’s Graph Explorer to try this out…

https://graph.facebook.com/myGroupID/members/nonMemberFBUserID?access_token=myAppsAppToken

The webpage returns an empty data object; “{“data”:[]}”.  And the Facebook Graph Explorer just lists all of the existing members along with some cryptic “paging” object with a “next” web address in it. If I go to this address directly, it says:

{ “error”: { “message”: “An access token is required to request this resource.”, “type”: “OAuthException”, “code”: 104 } }

 

But, as you can see, I passed an “access_token” variable, and does this mean the app or the user access_token? *shrug*

 

As for Corona tests, if instead of doing facebook.request, I do a network.request() POST with the above address I get an error “(#200) Requires extended permission: manage_groups”.  This might be the real meaning of the HTTP 200 I was getting above.  Adding this permission of “manage_groups” to the facebook.login() fails and returns an error.  The interesting thing is if you go to the Facebook Graph Explorer, and try to create an Access Token, there is NO option for “manage_groups”.  A few Google’s later and Facebook’s dev team says it’s not a public permission.  What the?!?

And in no case did my dummy FB email ever receive an invite by email or notification in Facebook.  So, even if all of this worked, I’m beginning to think it wouldn’t suit my purpose anyway.  I tried just doing an “Invite by Email” through Facebook’s regular UI to my dummy FB account.  When the dummy received the email to “Join the Group” it doesn’t automatically add them when they click the button; it just submits a “Request to Join”.  This defeats the purpose since it doesn’t indicate that they were invited by the app, as opposed to someone just requesting to join the group that doesn’t own the app.

 

So now I’m leaning towards having the app, after the user logs in and I determine they aren’t a member of the group, that their name and email is sent to a secure website that the moderators can check to compare against new group requests, and then we just add or deny based on that list. *shrug*

But I’d be curious to see if the Corona devs or anyone else has any more information on this.