---
source_url: https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/details
title: Get message details
updated_at: 2026-06-17T11:37:16.128Z
---

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

### Method signature

This method takes the following parameters:

```swift
channel.getMessage(
    timetoken: Timetoken
) async throws -> MessageImpl?
```

#### Input

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

#### Output

| Parameter | Description |
| --- | --- |
| `MessageImpl` | Returned [Message object](https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/message). |

### Sample code

:::tip Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
:::

Get the message with the `16200000000000001` timetoken.

```swift
// Assumes a "ChatImpl" reference named "chat"
Task {
  if let channel = try await chat.getChannel(channelId: "support") {
    let timetoken: Timetoken = 16200000000000001
    if let message = try await channel.getMessage(timetoken: timetoken) {
      debugPrint("Message fetched successfully: \(message.text)")
    } else {
      debugPrint("No message found with this timetoken.")
    }
  } else {
    debugPrint("Channel not found")
  }
}
```

## Get historical details

With [Message Persistence](https://www.pubnub.com/docs/sdks/swift/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/swift-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/swift-chat-sdk/learn/chat-entities/message) using the `text` property.

### Sample code

:::tip Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
:::

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

```swift
// Assumes a "ChatImpl" reference named "chat"
Task {
  if let channel = try await chat.getChannel(channelId: "support") {
    let timetoken: Timetoken = 16200000000000000
    if let message = try await channel.getMessage(timetoken: timetoken) {
      debugPrint("Message fetched successfully: \(message.text)")
    } else {
      debugPrint("No message found with this timetoken.")
    }
  } else {
    debugPrint("Channel not found")
  }
}
```

## Check deletion status

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

### Sample code

:::tip Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
:::

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

```swift
// Assumes a "ChatImpl" reference named "chat"
Task {
  if let channel = try await chat.getChannel(channelId: "support") {
    let timetoken: Timetoken = 16200000000000000
    if let message = try await channel.getMessage(timetoken: timetoken) {
      if message.deleted {
        debugPrint("The message was deleted.")
      } else {
        debugPrint("Message fetched successfully: \(message.text)")
      }
    } else {
      debugPrint("No message found with this timetoken.")
    }
  } else {
    debugPrint("Channel not found")
  }
}
```