メインコンテンツまでスキップ

Enable group notifications

Last updated on December 10, 2024

Overview

This article explains how to enable your game client to retrieve and deliver player group notifications using the AccelByte Gaming Services (AGS) Groups service. This article also includes sample notification payloads for common player group activities.

Enable game client to retrieve and deliver group notifications

In AGS, notifications for group activities are delivered as JSON-formatted payloads sent to the intended recipients.

To enable your game client to retrieve and deliver group notifications, add a callback to the SetMessageNotifDelegate and the OnNotification functions.

FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();

ApiClient->Lobby.Connect();

FString NotificationTopic = "group";

ApiClient->Lobby.SetMessageNotifDelegate(AccelByte::Api::Lobby::FMessageNotif::CreateLambda([&](FAccelByteModelsNotificationMessage const& Notif)
{
if (Notif.Topic == NotificationTopic)
{
// Do something if there's a new notification under group topic
}
}));

Sample payloads

This section provides sample payloads for various types of group-related notifications.

Received group invitation

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"
}

Accepted join group request

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"
}

Rejected join group request

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

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": "newGroupMember",
"kind": "new-member"
}

Admin notified of a join request

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": "newGroupMember",
"kind": "join-request"
}

New role assigned

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",
"roleName": "Chief",
"roleId": "roleId",
"kind": "assigned-role"
}

Role removed

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

{
"groupName": "nameofgroup",
"groupId": "groupId",
"roleName": "Chief",
"roleId": "roleId",
"kind": "removed-role"
}