---
source_url: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/messages/details
title: Get message details
updated_at: 2026-06-15T11:02:30.601Z
---

> 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/kotlin-chat-sdk/learn/chat-entities/message) from Message Persistence based on the message timetoken.

### Method signature

This method takes the following parameters:

```kotlin
channel.getMessage(timetoken: Long): PNFuture<Message?>
```

#### Input

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

#### Output

| Type | Description |
| --- | --- |
| `PNFuture<Message?>` | Returned [Message object](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/message). |

### Sample code

Get the message with the `16200000000000001` timetoken.

```kotlin
chat.getChannel("incident-management").async { channelResult ->
    channelResult.onSuccess { channel ->
        // successfully retrieved the channel
        channel?.getMessage(16200000000000001L)?.async { messageResult ->
            messageResult.onSuccess { message ->
                // handle success
                println("Message retrieved successfully: $message")
            }.onFailure { error ->
                // handle failure
                println("Failed to retrieve the message: ${error.message}")
            }
        }
    }.onFailure { error ->
        // failed to retrieve the channel
        println("Failed to retrieve the channel: ${error.message}")
    }
}
```

## Get historical details

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

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

## Get message content

Access the text content of a [Message object](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/message) using the `text` property.

### Sample code

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

```kotlin
channel.getMessage(16200000000000000).async { result ->
    result.onSuccess { message: Message? ->
        println(message?.text ?: "Message not found")
    }.onFailure { exception: PubNubException ->
        println("Exception occurred: ${exception.message} ")
    }
}
```

## Check deletion status

Check if a [Message object](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/message) was soft-deleted using the `deleted` property.

### Sample code

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

```kotlin
channel.getMessage(16200000000000000).async { result ->
    result.onSuccess { message: Message? ->
        when(message?.deleted){
            true -> println("Message is deleted")
            false -> println("Message is not deleted")
            null -> println("Message does not exist")
        }
    }.onFailure { exception: PubNubException ->
        println("Exception occurred: ${exception.message} ")
    }
}
```