---
source_url: https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/messages/details
title: Get message details
updated_at: 2026-05-25T05:44:15.014Z
---

> 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


# Get message details

Get message details, retrieve content, and check if the message was deleted.

##### 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. 1Channel->GetMessageAsync(Timetoken, OnGetMessageResponseDelegate); You can also use native callbacks that accept lambdas instead of dynamic delegates. Native callback types have the Native suffix (for example, FOnPubnubChatMessageResponseNative).
* Synchronous methods (no suffix) block the main game thread until the operation completes and return a result struct directly. 1FPubnubChatMessageResult Result = Channel->GetMessage(Timetoken);
:::

## Get message details

`GetMessage()` fetches the [Message object](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/message) from Message Persistence based on the message timetoken.

### Blueprint

### C++ / Input parameters

```cpp
Channel->GetMessage(FString Timetoken);
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| Timetoken | FString | Optional |  | Timetoken of the message you want to retrieve from Message Persistence. |

#### Output

| Field | Type | Description |
| --- | --- | --- |
| `Result` | `FPubnubChatOperationResult` | Operation result with `Error` (bool) and `ErrorMessage` (FString). |
| `Message` | `UPubnubChatMessage*` | Returned [Message object](https://www.pubnub.com/docs/chat/unreal-chat-sdk/learn/chat-entities/message). |

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

Fetch a specific message by timetoken asynchronously.

###### C++

###### Actor.h

```cpp
// blueprint.pnjs_e_h
UFUNCTION(BlueprintCallable, Category = "PubnubChat|Samples|ChatChannel")
void GetMessageSample();

UFUNCTION()
void OnGetMessageResponse(const FPubnubChatMessageResult& Result);
```

###### Actor.cpp

```cpp
// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::GetMessageSample()
{
	// snippet.hide
	UPubnubChatChannel* Channel = nullptr;
	// snippet.show

	// Assumes Channel is a valid UPubnubChatChannel (e.g. from GetChannel)

	// Timetoken of the message to fetch from this channel's history (17-digit PubNub timetoken)
	FString Timetoken = TEXT("17388000000000000");

	// Callback for when the operation completes (returns message or empty)
	FOnPubnubChatMessageResponseNative Callback;
	// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
	Callback.BindUObject(this, &ASample_ChatChannel::OnGetMessageResponse);
	Channel->GetMessageAsync(Timetoken, Callback);
}

// ACTION REQUIRED: Replace ASample_ChatChannel with name of your Actor class
void ASample_ChatChannel::OnGetMessageResponse(const FPubnubChatMessageResult& Result)
{
	if (Result.Result.Error) { return; }
	UPubnubChatMessage* Message = Result.Message;
}
```

###### Blueprint

## Get historical details

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 details of a given message, 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 actions and metadata attached to the retrieved messages.

## Get message content

`GetCurrentText()` returns the current text content of a message. If the message has been edited, this method computes the latest text from message actions.

### Method signature

#### Blueprint

#### C++ / Input parameters

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

#### Output

| Type | Description |
| --- | --- |
| `FString` | Current text content of the message, reflecting any edits. |

### Sample code

Get the content of the message with the `16200000000000000` timetoken.

#### C++

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

	// Assumes Message is a valid UPubnubChatMessage

	// Get the current text (includes latest edit if any)
	FString CurrentText = Message->GetCurrentText();
}
```

#### Blueprint

## Get message timetoken

`GetMessageTimetoken()` returns the unique timetoken identifier of the message.

### Method signature

#### Blueprint

#### C++ / Input parameters

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

#### Output

| Type | Description |
| --- | --- |
| `FString` | Timetoken of the message. |

### Sample code

Get the timetoken of a message.

#### C++

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

	// Assumes Message is a valid UPubnubChatMessage

	// Get the message timetoken (local, no network call)
	FString Timetoken = Message->GetMessageTimetoken();
}
```

#### Blueprint

## Get message type

`GetType()` returns the type of the message as a string.

### Method signature

#### Blueprint

#### C++ / Input parameters

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

#### Output

| Type | Description |
| --- | --- |
| `FString` | Type of the message (for example, `"text"`). |

### Sample code

Get the type of a message.

#### C++

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

	// Assumes Message is a valid UPubnubChatMessage

	// Get the message type (e.g. "text")
	FString Type = Message->GetType();
}
```

#### Blueprint

## Get message data

`GetMessageData()` returns the full message data struct.

### Method signature

#### Blueprint

#### C++ / Input parameters

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

#### Output

| Type | Description |
| --- | --- |
| `FPubnubChatMessageData` | Struct containing the full message data (Type, Text, ChannelID, UserID, Meta, MessageActions). |

### Sample code

Get the full data of a message.

#### C++

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

	// Assumes Message is a valid UPubnubChatMessage

	// Get message data from local cache (local, no network call)
	FPubnubChatMessageData MessageData = Message->GetMessageData();
	FString Text = MessageData.Text;
}
```

#### Blueprint

## Check deletion status

`IsDeleted()` checks whether the message has been [soft-deleted](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/messages/delete).

### Method signature

#### Blueprint

#### C++ / Input parameters

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

#### Output

| Field | Type | Description |
| --- | --- | --- |
| `Result` | `FPubnubChatOperationResult` | Operation result with `Error` (bool) and `ErrorMessage` (FString). |
| `IsDeleted` | `bool` | Info on whether the message has the `deleted` status (because it was previously [soft-deleted](https://www.pubnub.com/docs/chat/unreal-chat-sdk/build/features/messages/delete)) or not. |

### Sample code

Check the deletion status of a message.

#### C++

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

	// Assumes Message is a valid UPubnubChatMessage

	// Check whether this message is marked as deleted (local check)
	FPubnubChatIsDeletedResult Result = Message->IsDeleted();
	bool bIsDeleted = Result.IsDeleted;
}
```

#### Blueprint