---
source_url: https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/messages/reactions
title: Reactions
updated_at: 2026-06-19T11:35:28.034Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Reactions

Manage emoji reactions on messages in your Chat SDK app. Users can add, remove, and view reactions on any message.

:::note Message Actions vs. Message Reactions
**Message Actions** is the flexible, low-level API for adding any metadata to messages (read receipts, delivery confirmations, custom data), while **Message Reactions** specifically refers to using Message Actions for emoji/social reactions.
In PubNub [Core](https://www.pubnub.com/docs/sdks) and [Chat](https://www.pubnub.com/docs/chat/overview) SDKs, the same underlying Message Actions API is referred to as **Message Reactions** when used for emoji reactions - it's the same functionality, just different terminology depending on the use case.
:::

##### Usage in Blueprints and C++

You can use PubNub's functionality via Blueprints or directly in C++ code.

* In Blueprints, you can access PubNub from any Widget or Actor. Start by [initializing chat](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/configuration#initialize-pubnub-chat) using `InitChat` on `UPubnubChatSubsystem`. Afterwards, you can use the returned `UPubnubChat` object reference to call all Chat SDK functions.

:::warning Blueprint functions
The Blueprints provided in the documentation show how you can structure your application and may contain utility methods and elements like buttons that are not part of the Unreal Chat SDK and are meant to serve as guidance.
:::

* In C++, you can use UPubnubChatSubsystem as any other Game Instance Subsystem. #include "Kismet/GameplayStatics.h" #include "Engine/GameInstance.h" #include "PubnubChatSubsystem.h" // ACTION REQUIRED: Replace ASample_ChatSubsystem with name of your Actor class void ASample_ChatSubsystem::InitChatSample() { // Get PubnubChatSubsystem from GameInstance UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this); UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>(); // Initialize Chat - InitChat may fail under some conditions so make sure to check the Result for errors before using the Chat FPubnubChatInitChatResult InitChatResult = PubnubChatSubsystem->InitChat(TEXT("demo"), TEXT("demo"), TEXT("Player_001")); UPubnubChat* PubnubChat = InitChatResult.Chat; } Chat now allows you to call all Chat SDK functions, for example, Chat->GetChannel("my_channel").

:::note 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->ToggleReactionAsync(Reaction, OnToggleReactionResponseDelegate); 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->ToggleReaction(Reaction);
:::

## Add & delete

`ToggleReaction()` is a method for both adding and removing message reactions. It adds a string flag to the message if the current user hasn't added it yet or removes it if the current user already added it before.

If you use this method to add or remove message reactions, this flag would be a literal emoji you could implement in your app's UI. However, you could also use this method for a different purpose, like marking a message as pinned to a channel or unpinned if you implement the [pinning feature](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/messages/pinned) in your chat app.

### Method signature

#### Blueprint

#### C++ / Input parameters

```cpp
Message->ToggleReaction(FString Reaction);
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| Reaction | FString | Yes |  | Emoji added to the message or removed from it by the current user. |

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatOperationResult` | Result of the operation. Check `Error` and `ErrorMessage` for failure. |

### Sample code

:::tip 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.
:::

Toggle a reaction on a message asynchronously.

###### C++

###### Actor.h

```cpp
// blueprint.t6cuxad-
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatMessage")
void ToggleReactionSample();
```

###### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_ChatMessage with name of your Actor class
void ASample_ChatMessage::ToggleReactionSample()
{
	// snippet.hide
	UPubnubChatMessage* Message = nullptr;
	// snippet.show

	// Assumes Message is a valid UPubnubChatMessage

	// Reaction value to toggle for the current user
	FString Reaction = TEXT("thumbs_up");

	// Toggle the reaction (add or remove)
	Message->ToggleReactionAsync(Reaction, nullptr);
}
```

###### Blueprint

## Get updates

To learn how to receive updates whenever a message reaction is added, edited, or removed on other clients, head to the [Get updates](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/messages/updates#get-message-updates) section.

## Get reactions for one message

`GetReactions()` returns a list of all reactions added to the given message (with the ID of the user who added it and the timetoken stating when this action was added).

### Method signature

#### Blueprint

#### C++ / Input parameters

```cpp
Message->GetReactions();
```

#### Output

| Field | Type | Description |
| --- | --- | --- |
| `Result` | `FPubnubChatOperationResult` | Operation result with `Error` (bool) and `ErrorMessage` (FString). |
| `Reactions` | `TArray<FPubnubChatMessageReaction>` | An array of reaction objects. Each `FPubnubChatMessageReaction` contains: `Value` (`FString`), `IsMine` (`bool`), `UserIDs` (`TArray<FString>`), `Count` (`int`). |

### Sample code

List all reactions added to a message on the `support` channel.

#### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatMessage with name of your Actor class
void ASample_ChatMessage::GetReactionsSample()
{
	// snippet.hide
	UPubnubChatMessage* Message = nullptr;
	// snippet.show

	// Assumes Message is a valid UPubnubChatMessage

	FPubnubChatGetReactionsResult Result = Message->GetReactions();
	if (Result.Result.Error) { return; }
	TArray<FPubnubChatMessageReaction> Reactions = Result.Reactions;
}
```

#### Blueprint

## Get historical reactions

If you have [Message Persistence](https://www.pubnub.com/docs/sdks/javascript/api-reference/storage-and-playback) enabled on your keyset, PubNub stores all historical info about messages, their metadata, and reactions.

If you want to fetch historical info about message reactions, use the [GetHistory()](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/messages/history) method. By default, when you fetch historical messages, PubNub returns all message reactions and metadata attached to the retrieved messages.

## Check

`HasUserReaction()` checks if the current user added a given emoji to the message.

### Method signature

#### Blueprint

#### C++ / Input parameters

```cpp
Message->HasUserReaction(FString Reaction);
```

| Parameter | Description |
| --- | --- |
| `Reaction` *Type: `FString`Default: n/a | Specific emoji added to the message. |

#### Output

| Field | Type | Description |
| --- | --- | --- |
| `Result` | `FPubnubChatOperationResult` | Operation result with `Error` (bool) and `ErrorMessage` (FString). |
| `HasReaction` | `bool` | Specifies if the current user added a given emoji to the message or not. |

### Sample code

Check if the current user added the "thumb up" emoji to a message on the `support` channel.

#### C++

```cpp
// ACTION REQUIRED: Replace ASample_ChatMessage with name of your Actor class
void ASample_ChatMessage::HasUserReactionSample()
{
	// snippet.hide
	UPubnubChatMessage* Message = nullptr;
	// snippet.show

	// Assumes Message is a valid UPubnubChatMessage

	// Reaction value to check for the current user
	FString Reaction = TEXT("thumbs_up");

	FPubnubChatHasReactionResult Result = Message->HasUserReaction(Reaction);
	if (Result.Result.Error) { return; }
	bool bHasReaction = Result.HasReaction;
}
```

#### Blueprint