On this page

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++


Flag/Report messages

Report() flags a message for admin review.

Method signature

Output

This method doesn't return any value.

Sample code

Report a message on the support channel as offensive.

1#include "Kismet/GameplayStatics.h"
2#include "PubnubChatSubsystem.h"
3
4UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
5UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
6
7UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
8
9UPubnubChannel* Channel = Chat->GetChannel("support");
10
11FString Timetoken = "16200000000000001";
12
13// Fetch the message
14UPubnubMessage* Message = Channel->GetMessage(Timetoken);
15
show all 16 lines

Listen to report events

ListenForEvents() monitors report events for moderation dashboards.

Events documentation

See Chat events for report event details.

Method signature

icon

Handle the response

Output

This method doesn't return any value.

Sample code

Print a notification for an offensive message reported on the support channel.

1#include "Kismet/GameplayStatics.h"
2#include "PubnubChatSubsystem.h"
3
4UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
5UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();
6
7UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");
8
9UPubnubChannel* Channel = Chat->GetChannel("support");
10
11FString Timetoken = "16200000000000001";
12
13// Fetch the message
14UPubnubMessage* Message = Channel->GetMessage(Timetoken);
15
show all 27 lines
Last updated on