Report offensive messages

Message Persistence

Enable Message Persistence in the Admin Portal.

Users can report offensive messages directly from your app. Reported messages publish to PUBNUB_INTERNAL_ADMIN_CHANNEL and emit report events.

Add custom logic using emitted events to handle reported messages (e.g., delete them).

icon

Usage in Blueprints and C++


Asynchronous and synchronous method execution

Most PubNub Unreal SDK methods are available in both asynchronous and synchronous variants.

  • Asynchronous methods (Async suffix) return void and take an optional delegate parameter that fires when the operation completes.

    1Message->ReportAsync(OnReportResponseDelegate, Reason);

    You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the Native suffix (for example, FOnPubnubChatOperationResponseNative).

  • Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly.

    1FPubnubChatOperationResult Result = Message->Report(Reason);

Flag/Report messages​

Report() flags a message for admin review.

Method signature​

Output​

TypeDescription
FPubnubChatOperationResultResult of the operation. Check Error and ErrorMessage for failure.

Sample code​

Reference code

This example is a self-contained code snippet ready to be run. Set up your Unreal project and follow the instructions in the lines marked with ACTION REQUIRED before running the code. Use it as a reference when working with other examples in this document.

Report a message asynchronously.

Actor.h​
1

Actor.cpp​
1

Stream message report events​

StreamMessageReports() subscribes to real-time report events on a channel. Bind the channel's OnMessageReported delegate before calling this method to receive report events.

note

Use this method for channels where you want live monitoring of reported messages, such as an admin moderation dashboard.

Method signature​

1Channel->StreamMessageReports();

Bind the channel's OnMessageReported delegate before calling StreamMessageReports() to receive report events.

Output​

TypeDescription
FPubnubChatOperationResultResult of the operation. Check Error for failure.

Sample code​

Stream report events on the support channel.

1

Other examples​

Stop streaming report events.

Actor.h​
1

Actor.cpp​
1

Get message reports history​

GetMessageReportsHistory() retrieves historical report events from a channel, similar to GetHistory() for messages. Use this to audit past message reports.

Method signature​

1Channel->GetMessageReportsHistory(
2 FString StartTimetoken,
3 FString EndTimetoken,
4 int Count = 100
5);
* required
ParameterDescription
StartTimetoken
Type: FString
Default:
n/a
Timetoken delimiting the start of a time slice (exclusive) to pull report events from.
EndTimetoken
Type: FString
Default:
n/a
Timetoken delimiting the end of a time slice (inclusive) to pull report events from.
Count
Type: int
Default:
100
Number of historical report events to return for the channel in a single call. Maximum: 100.

Output​

ParameterDescription
FPubnubChatEventsResult
Type: struct
Returned object containing Result, Events, and IsMore.
 → Result
Type: FPubnubChatOperationResult
Operation result with Error (bool), ErrorMessage (FString), and StepResults.
 → Events
Type: TArray<FPubnubChatEvent>
Array of historical report event objects.
 → IsMore
Type: bool
Indicates whether there are more historical events to pull.

Sample code​

Fetch the last 10 report events from the support channel.

1

Was this page useful?

Last updated on