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

Manage system inbox notifications

Last updated on August 16, 2024

Overview

AccelByte Gaming Services (AGS) Chat includes a system inbox notifications feature that enables you to send persistent system notifications to players' inboxes. Examples of system inbox notifications you can send include in-game news, in-game mail, gifts, redemption codes, penalty notifications, player report notifications, maintenance schedules, current events, and more. You can also delete or unsend any notifications from a player's inbox, if necessary.

This article provides information on how to manage and integrate system inbox notifications.

Prerequisites

Administrators must have the following permissions to manage system inbox notifications:

PermissionsActionUsage
ADMIN:NAMESPACE:{namespace}:CHAT:INBOXCREATE, READ, UPDATE, DELETETo create, query, edit and remove notifications.
ADMIN:NAMESPACE:{namespace}:CHAT:INBOXCREATE, READ, UPDATE, DELETETo create system message.

Access the system messages page

To access the management and configuration options outlined in the following sections, log in to your AGS Admin Portal and go to your game namespace dashboard. Then, go to Social > Chat > System Messages.

Manage system inbox notifications

The following sections detail the management of system inbox notifications.

Create, save, and send a notification

To create and send a new system inbox notification, follow these steps:

  1. On the System Messages page, click the + Create new.

  2. Fill out the Create New Message page with the content, recipient, and notification details of your message.

  3. Click Save as Draft to send the message later, or click Send to send the message right away.

Unsend a notification

  1. On the System Messages page, find the sent notification you want to unsend listed under the System Messages List section.

  2. Next to the sent notification, click the ellipsis menu next to it under the Action column. Then, click Unsend.

  3. On the confirmation box, type UNSEND and click Unsend to confirm.

View, edit, and send draft notifications

  1. On the System Messages page, find the draft notification you want to view, edit, or send listed under the System Messages List section.

  2. Next to the draft notification, click the View option next to it under the Action column.

  3. Review the information and make any desired changes.

  4. Click Save as Draft to update the message without sending, or click Send to send the message right away.

Integrate system inbox notification into the game client

The example below shows you how to integrate system inbox notification into the game client:

// Create API client, login, and connect to AGS Chat
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient(TEXT("0"));
ApiClient->User.LoginWithUsername(TEXT("user+a@example.com"), TEXT("Password321"),
FVoidHandler::CreateLambda([]()
{
UE_LOG(LogTemp, Log, TEXT("Login User A successful"));
}),
FErrorHandler::CreateLambda([](int Code, FString const& Message)
{
UE_LOG(LogTemp, Log, TEXT("Login User A failed"));
}));
ApiClient->Chat.Connect();
// Set delegate for incoming system message notification
ApiClient->Chat.SetSystemMessageNotifDelegate(
Api::Chat::FSystemMessageNotif::CreateLambda([](const FAccelByteModelsChatSystemMessageNotif&
Notif)
{
UE_LOG(LogTemp, Log, TEXT("Got System Message: %s %s %s"), *Notif.MessageId, *Notif.Message,
*Notif.Category);
}));
// Query system message
{
FAccelByteModelsQuerySystemMessagesResponse Result;
Chat::FQuerySystemMessageResponse OnSuccess = Chat::FQuerySystemMessageResponse::CreateLambda(
[&Result](const FAccelByteModelsQuerySystemMessagesResponse& Response)
{
Result = Response;
});
FErrorHandler OnError = FErrorHandler::CreateLambda([](int32 Code, const FString& Message)
{
UE_LOG(LogTemp, Error, TEXT("Failed query chat system message %d, %s"), Code, *Message);
});
ApiClient->Chat.QuerySystemMessage(OnSuccess, OnError);
}
// Update system message (mark read/unread or keep messages)
{
FAccelByteModelsActionUpdateSystemMessage Action;
Action.ID = TEXT("message-id");
Action.Read = EAccelByteOptionalBool::NO; // mark message as unread
Action.Keep = EAccelByteOptionalBool::YES; // mark message to keep in inbox
Chat::FUpdateSystemMessagesResponse OnSuccess =
Chat::FUpdateSystemMessagesResponse::CreateLambda(
[](const FAccelByteModelsUpdateSystemMessagesResponse& Response)
{
UE_LOG(LogTemp, Log, TEXT("Update system message success"));
});
FErrorHandler OnError = FErrorHandler::CreateLambda([](int32 Code, const FString& Message)
{
UE_LOG(LogTemp, Error, TEXT("Failed update chat system message %d, %s"), Code, *Message);
});
ApiClient->Chat.UpdateSystemMessages({Action}, OnSuccess, OnError);
}
// Delete system message
{
Chat::FDeleteSystemMessagesResponse OnSuccess =
Chat::FDeleteSystemMessagesResponse::CreateLambda(
[](const FAccelByteModelsDeleteSystemMessagesResponse& Response)
{
UE_LOG(LogTemp, Log, TEXT("Delete system message success"));
});
FErrorHandler OnError = FErrorHandler::CreateLambda([](int32 Code, const FString& Message)
{
UE_LOG(LogTemp, Error, TEXT("Failed delete chat system message %d, %s"), Code, *Message);
});
ApiClient->Chat.DeleteSystemMessages({TEXT("message-id")}, OnSuccess, OnError);
}
// Get system message stats
{
FAccelByteGetSystemMessageStatsResponse Result;
Chat::FGetSystemMessageStatsResponse OnSuccess =
Chat::FGetSystemMessageStatsResponse::CreateLambda(
[&Result](const FAccelByteGetSystemMessageStatsResponse& Response)
{
Result = Response;
});
FErrorHandler OnError = FErrorHandler::CreateLambda([](int32 Code, const FString& Message)
{
UE_LOG(LogAccelByteChatTest, Error, TEXT("Failed get system message stats %d,
%s"), Code, *Message);
});
ApiClient->Chat.GetSystemMessageStats(OnSuccess, OnError);
}