App and Game Groups is designed so that apps can create and manage groups to help people connect and share their experiences. One of the main use cases for Groups is games, which already organize their players into groups through clans, alliances, guilds or other game communities. For this reason, we will refer to the feature as "Game Groups" going forward in this document.
This feature exposes an API to do the following:
Game Groups have a privacy setting which controls who sees the group.
Game Groups are created and controlled by the application.
Applications can get all the groups that belong to an application by issuing a GET request to /APP_ID/groups with an app access_token.
If the action is successful, the response will be an array that contains elements with the following properties:
| Name | Description | Type |
|---|---|---|
id |
The id of the group. | string |
name |
The name of the group. | string |
Applications can get all the groups a user belongs in an application by issuing a GET request to /me/groups?parent=APP_ID with a user access_token. This requires the user_groups permission.
If the action is successful, the response is an array in which each element contains:
| Name | Description | Type |
|---|---|---|
id |
The id of the group. | string |
name |
The name of the group. | string |
administrator |
The user is administrator of the group. This field will only be returned if the user is an administrator. | boolean |
Applications create a group issuing a POST request to /APP_ID/groups with an app access_token. Optionally, a user can be set as an admin of a group by setting the admin parameter.
| Parameter | Description | Type | Required |
|---|---|---|---|
name |
A name for the group. | string |
yes |
description |
A description for the group. | string |
no |
privacy |
The privacy setting for the group. | string (open, closed, secret) |
no (default: closed) |
admin |
The user ID of the admin. | string |
no |
If the action is successful, the response will contain:
| Name | Description | Type |
|---|---|---|
id |
The id of the group. | string |
Applications delete a group issuing a DELETE request to /APP_ID/groups/GROUP_ID with an app access_token.
If the group has no members, the group will be irreversibly deleted. If the group has members, the group will no longer be associated with the application and become a normal Facebook Group.
If the action is successful, the response will contain true.
Applications can get the list of members that belong to a group by issuing a GET request to /GROUP_ID/members with an app access_token.
If the action is successful, the response will contain:
| Name | Description | Type |
|---|---|---|
id |
The id of the user. | string |
name |
The name of the user. | string |
administrator |
The user is administrator of the group. | boolean |
Applications can invite users to a group by issuing a POST request to /GROUP_ID/members/USER_ID with an app access_token.
Note that user being invited must be a user of the application. The user will be sent a notification saying that they have been invited to the group. The notification will take them to the group page. Users can only be invited once. Subsequent invites will fail.
Optionally, a from parameter can be passed in the request. If the from parameter is included, then the invite request will look like it was sent by the from user. If this parameter is not included, then the invite request will appear to come from the application. Invites sent on behalf of a user can only be sent to the sender's friends.
| Parameter | Description | Type | Required |
|---|---|---|---|
from |
The ID of the user doing the inviting. | string |
no |
If the action is successful, the response will contain true.
Users can be removed from a group by issuing a DELETE request to GROUP_ID/members/USER_ID with an app access_token.
If the action is successful, the response will contain true.
A member of a group can be promoted to admin by issuing a POST request to /GROUP_ID/admins/USER_ID with an app access_token. The user must be a member of the group. The user will receive a notification that they have been made an admin for the group.
If the action is successful, the response will contain true.
A member of a group can be promoted to admin by issuing a DELETE request to /GROUP_ID/admins/USER_ID with an app access_token.
If the action is successful, the response will contain true.
Users can post a link on the Group's wall by issuing an HTTP POST request to /GROUP_ID/feed with the publish_actions permissions and the following parameters. (publish_stream will also work, but you should use publish_actions.) This requires a user access_token.
| Parameter | Description | Type | Required |
|---|---|---|---|
message |
Post message | string |
either message or link |
link |
Post URL | string |
either message or link |
picture |
Post thumbnail image (can only be used if link is specified) |
string |
no |
name |
Post name (can only be used if link is specified) |
string |
no |
caption |
Post caption (can only be used if link is specified) |
string |
no |
description |
Post description (can only be used if link is specified) |
string |
no |
If the create is successful, the response will contain:
| Name | Description | Type |
|---|---|---|
id |
The new post ID | string |
Applications can set the cover photo for a group by issuing a POST request to /GROUP_ID with an app access_token.
| Name | Description | Type | Required |
|---|---|---|---|
cover_url |
The url for the cover photo. The image will be downloaded and added to the group's album and then used as a cover photo. | string |
yes |
If the action is successful, the response will contain true.
Applications can get events for a group by issuing a GET request to /GROUP_ID/events with a user access_token.
If the action is successful, the response will contain:
| Name | Description | Type |
|---|---|---|
id |
The id of the event. | string |
name |
The name of the event | string |
start_time |
Start time of the event in ISO-8601 format. | string
|
end_time |
End time of the event in ISO-8601 format. | string
|
location |
Location of the event. | string |
Users can create an event for a group by issuing a POST request to /GROUP_ID/events with a user access_token. The user needs the create_event permission.
All event times are ISO-8601 formatted strings (e.g., '2012-07-04', '2012-07-04T19:00:00-0700'). Event times containing the time must have the UTC offset.
| Parameter | Description | Type | Required |
|---|---|---|---|
name |
Name of event. | string |
yes |
start_time |
Start time of the event in ISO-8601 format. | string |
yes |
end_time |
End time of the event in ISO-8601 format. | string |
no |
description |
Description of the event. | string |
no |
location |
Location of the event. | string |
no |
location_id |
Facebook Place ID of the place for the event. | string |
no |
If the create is successful, the response will contain:
| Name | Description | Type |
|---|---|---|
id |
The new event ID | string |