Method signature

Method is used to ask users if they want to join a group that is linked to your game.

Method also enables group messages automatically if user has agreed to join to a group. If he already was in a group but messages were disabled for him, method enables group messages after user has accepted them to be enabled.

FAPI.UI.joinGroup(groupId, enabledMessages);

Example usage

function joinGroup() {
FAPI.UI.joinGroup(123123123, true);
}

Recommendations

We recommend to check user’s status before calling this method:

Also make sure your group matches following conditions:

  • group is public (can be set in it’s settings);
  • group should not have age restrictions (can be set in it’s settings);
  • group must be linked to your game (can be set in app’s settings)
  • if you plan to use group messages - they must be enabled in group’s settings (more about group messages)

Callback example

As a result a client callback function will be called. All essential data will be passed to it.

Callback for a successful method call

method: “joinGroup”

result: “ok”

data: “ready”

Callback in case of an error / method cancellation

method: “joinGroup”

result: “error”

data: errorCode

Error codes

If an error occurred it’s code will be passed in a data field of a client callback:

  • cancel - user did not accept to join;
  • already.member - user is already a member of a group;
  • group.access.denied - group is not linked to a game;
  • common.finder - specified group was not found.