Report offensive messages
Unreal Chat SDK provides a mechanism for users to report offensive content in messages directly from their applications.
In each case, a user must provide a reason for flagging a given message. As a result of flagging, a reported message gets published on the dedicated administrative channel (with the PUBNUB_INTERNAL_ADMIN_CHANNEL
ID) and an event of the report
type gets created.
As a developer, you can add custom logic that uses the emitted events and defines what an admin can later do with such reported messages. For example, an admin can delete an inappropriate message.
Message Persistence
To work with stored message data, you must enable Message Persistence for your app's keyset in the Admin Portal.
Flag/Report messages
Report()
lets you flag and report an inappropriate message to the admin.
Method signature
- Blueprint
- C++ / Input parameters
Message->Report(FString Reason);
Parameter | Type | Required | Description |
---|---|---|---|
Report | FString | Yes | Reason for reporting/flagging a given message. |
Output
This method doesn't return any value.
Basic usage
Report a message on the support
channel as offensive.
#include "Kismet/GameplayStatics.h"
#include "PubnubChatSubsystem.h"
UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
UPubnubChannel* Channel = Chat->GetChannel("support");
FString Timetoken = "16200000000000001";
// Fetch the message
UPubnubMessage* Message = Channel->GetMessage(Timetoken);
show all 16 linesListen to report
events
As an admin of your chat app, you can monitor all events emitted when someone reports an offensive message using the ListenForEvents()
method. You can use this method to create moderation dashboard alerts.
Events documentation
To read more about the events of type report
, refer to the Chat events documentation.
Method signature
- Blueprint
- C++ / Input parameters
Chat->ListenForEvents(
FString ChannelID,
EPubnubChatEventType ChatEventType,
FOnPubnubEventReceived EventCallback
);
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
ChannelID | FString | Yes | n/a | Channel to listen for new report events. Set this value to a dedicated PUBNUB_INTERNAL_ADMIN_CHANNEL where all report events are sent. |
ChatEventType | EPubnubChatEventType | No | n/a | Type of events. PCET_REPORT is the type defined for all events emitted when an offensive message is flagged/reported. |
EventCallback | FOnPubnubEventReceived | Yes | n/a | Callback function passed as a parameter. It defines the custom behavior to be executed whenever an invite event type is detected on the specified channel. |
EPubnubChatEventType
Value | Description |
---|---|
PCET_TYPING | Indicates a user is typing a message. Displayed as Typing. |
PCET_REPORT | Represents an event where a message has been flagged or reported for offensive content. Displayed as Report. |
PCET_RECEIPT | Confirms receipt of a message or event. Displayed as Receipt. |
PCET_MENTION | Indicates that a user has been mentioned in a message. Displayed as Mention. |
PCET_INVITE | Represents an invitation event typically sent to a specific user. Displayed as Invite. |
PCET_CUSTOM | Custom event type for specialized behavior or use cases. Displayed as Custom. |
PCET_MODERATION | Represents an event related to content moderation actions. Displayed as Moderation. |
Output
This method doesn't return any value.
Basic usage
Print a notification for an offensive message reported on the support
channel.
#include "Kismet/GameplayStatics.h"
#include "PubnubChatSubsystem.h"
UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
UPubnubChannel* Channel = Chat->GetChannel("support");
FString Timetoken = "16200000000000001";
// Fetch the message
UPubnubMessage* Message = Channel->GetMessage(Timetoken);
show all 27 lines