---
source_url: https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/details
title: Get message details
updated_at: 2026-06-11T11:34:20.687Z
---

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

## Get message details

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

### Method signature

### Method signature

This method takes the following parameters:

```csharp
channel.GetMessage(
    string timeToken
)
```

#### Input

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| timeToken | string | Yes |  | Timetoken of the message you want to retrieve from Message Persistence. |

#### Output

Returns an awaitable `Task<ChatOperationResult<Message>>` with the `Message` object if found, otherwise the `Error` property on the result will be true.

#### Sample code

Get the message with the `16200000000000001` timetoken.

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using UnityEngine;

// Configuration
PubnubChatConfig chatConfig = new PubnubChatConfig();
        
PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
{
    SubscribeKey = "demo",
    PublishKey = "demo",
    Secure = true
};

// Initialize Unity Chat
var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration);
if (!chatResult.Error)
{
    chat = chatResult.Result;
}
// reference the "support" channel
var channelResult = await chat.GetChannel("support");
if (channelResult.Error)
{
    Debug.Log("Couldn't find channel!");
    return;
}
var channel = channelResult.Result;

// get the message
var messageResult = await channel.GetMessage("16200000000000001");
if (!messageResult.Error)
{
    var message = messageResult.Result;
    Debug.Log($"Message: {message.MessageText}");
}
```

## Get historical details

With [Message Persistence](https://www.pubnub.com/docs/sdks/unity/api-reference/storage-and-playback) enabled, PubNub stores all historical message data, metadata, and reactions.

Fetch historical message details with [GetMessageHistory()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/history). By default, all message reactions and metadata are included in the response.

## Get message content

You can access the `MessageText` property of the [Message object](https://www.pubnub.com/docs/chat/unity-chat-sdk/learn/chat-entities/message) to receive its text content.

### Method signature

This is how you can access the property:

```csharp
message.MessageText: string
```

#### Properties

| Property | Description |
| --- | --- |
| `MessageText`Type: `string` | Text content of the returned message. |

### Sample code

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

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using UnityEngine;

// Configuration
PubnubChatConfig chatConfig = new PubnubChatConfig();
        
PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
{
    SubscribeKey = "demo",
    PublishKey = "demo",
    Secure = true
};

// Initialize Unity Chat
var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration);
if (!chatResult.Error)
{
    chat = chatResult.Result;
}
// reference the "support" channel
var channelResult = await chat.GetChannel("support");
if (channelResult.Error)
{
    Debug.Log("Couldn't find channel!");
    return;
}
var channel = channelResult.Result;

// get the message
var messageResult = await channel.GetMessage("16200000000000001"); 
if (!messageResult.Error) 
{
    var message = messageResult.Result;
    Debug.Log($"Message: {message.MessageText}");
}
```

## Check deletion status

You can access the `IsDeleted` property of the [Message object](https://www.pubnub.com/docs/chat/unity-chat-sdk/learn/chat-entities/message) to check if it's deleted.

### Method signature

This is how you can access the property:

```csharp
message.IsDeleted: bool
```

#### Properties

| Property | Description |
| --- | --- |
| `IsDeleted`Type: `bool` | Info on whether the message has the `IsDeleted` flag set to `true` or not. |

### Sample code

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

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using UnityEngine;

// Configuration
PubnubChatConfig chatConfig = new PubnubChatConfig();
        
PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
{
    SubscribeKey = "demo",
    PublishKey = "demo",
    Secure = true
};

// Initialize Unity Chat
var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration);
if (!chatResult.Error)
{
    chat = chatResult.Result;
}
// get the message
// reference the "support" channel
var channelResult = await chat.GetChannel("support");
if (channelResult.Error)
{
    Debug.Log("Couldn't find channel!");
    return;
}
var channel = channelResult.Result;

// get the message
var messageResult = await channel.GetMessage("16200000000000000"); 
if (!messageResult.Error) 
{
   var message = messageResult.Result;
   Debug.Log($"Is deleted?: {message.IsDeleted}");
}
```