Skip to main content

Group Notifications

Last updated on

Some group activity will trigger notifications that will be sent to individual players, to group admins, or to all group members. The notification payload will be a JSON formatted string that contains data related to the triggered activity. To retrieve these notifications, you need to add a callback to the OnNotification function.

AccelBytePlugin.GetLobby().Connect();
AccelBytePlugin.GetLobby().OnNotification += result =>
{
if (result.IsError)
{
// Do something if OnNotification has an error
Debug.Log($"Error OnNotification, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if OnNotification has been successful
}
};

Group Invitation Notifications

Here's an example of the payload for a notification sent to a player when they've been invited to join a group:

{
"groupName": "nameOfGroup",
"groupId": "groupId",
"kind": "invitation"
}

Group Acceptance Notifications

Here's an example of the payload for a notification sent to a player when their request to join a group has been accepted:

{
"groupName": "nameOfGroup",
"groupId": "groupId",
"kind": "accepted-request"
}

Group Rejection Notifications

Here's an example of the payload for a notification sent to a player when their request to join a group has been rejected:

{
"groupName": "nameOfGroup",
"groupId": "groupId",
"kind": "rejected-request"
}

New Group Member Notifications

Here's an example of the payload for a notification sent to all group members when a new member has joined their group:

{
"groupName": "nameOfGroup",
"groupId": "groupId",
"newGroupMember": "newGroupMemberId",
"kind": "new-member"
}

Member Request Notifications

Here's an example of the payload for a notification sent to group admins when a player has requested to join their group:

{
"groupName": "nameOfGroup",
"groupId": "groupId",
"newGroupMember": "newGroupMemberId",
"kind": "join-request"
}

Member Role Assignment Notifications

Here's an example of the payload for a notification sent to a player when a group admin has assigned a role to them:

{
"groupName": "nameOfGroup",
"groupId": "groupId",
"newGroupMember": "newGroupMemberId",
"roleId": "roelId",
"kind": "assigned-role"
}

And here's the payload if a group admin removes a role from a player:

{
"groupName": "nameOfGroup",
"groupId": "groupId",
"newGroupMember": "newGroupMemberId",
"roleId": "roelId",
"kind": "removed-role"
}