facebookfacebook-graph-apiinvitefacebook-invitefacebook-group

Request join a group for Facebook Graph API


We developed a system which interacts with Facebook using the Graph API. In this case, I am trying to post a message in a group and I am with the following return:

My request in this Graph well:

v2.3/402998003100416/feed?message=hello

And the return is this:

{
  "error": {
    "message": "Permissions error", 
    "type": "FacebookApiException", 
    "code": 200, 
    "error_subcode": 1376025, 
    "is_transient": false, 
    "error_user_title": "No Permission to Post", 
    "error_user_msg": "You do not have permission to post in this group."
  }
}

Obviously the problem is that the group's privacy is "closed" and I could only publish if it were a member, but I have not asked to participate in the group. My intention is precisely this, use the Graph to submit a request to join the group, something like clicking the "+ Group Join" facebook button itself. How to do it?

Leveraging the same way, I wonder if I can enjoy one fan page for the graph api.


Solution

  • Apps can only invite users to a group created by that App, as you can read in the docs: https://developers.facebook.com/docs/graph-api/reference/v2.3/group/members#publish

    It is NOT possible to send requests or invites to normal groups with the API.

    For creating a post in a group, you would need publish_actions and user_groups: https://developers.facebook.com/docs/graph-api/reference/v2.3/group/feed#publish

    Keep in mind that you will most likely not get user_groups approved:

    This permission is granted to apps building a Facebook-branded client on platforms where Facebook is not already available. For example, Android and iOS apps will not be approved for this permission. In addition, Web, Desktop, in-car and TV apps will not be granted this permission.

    https://developers.facebook.com/docs/facebook-login/permissions/v2.3#reference-user_groups

    Edit: Facebook recently released a new permission user_managed_groups for accessing groups the user is an admin of.