---
source_url: https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/thread-message
title: ThreadMessage object
updated_at: 2026-06-16T12:48:56.685Z
---

> 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


# ThreadMessage object

`ThreadMessage` represents a single message in a thread.

## Properties

The `ThreadMessageImpl` class extends [MessageImpl](https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/message) and implements the `ThreadMessage` protocol. It takes the following properties:

```swift
extension ThreadMessageImpl: ThreadMessage {
    public var chat: ChatImpl
    public var timetoken: Timetoken
    public var content: EventContent.TextMessageContent
    public var channelId: String
    public var userId: String
    public var actions: [String: [String: [Action]]]? // deprecated
    public var meta: [String: JSONCodable]?
    public var mentionedUsers: MessageMentionedUsers? // deprecated
    public var referencedChannels: MessageReferencedChannels? // deprecated
    public var quotedMessage: QuotedMessage?
    public var text: String
    public var deleted: Bool
    public var hasThread: Bool
    public var type: String
    public var files: [File]
    public var reactions: [MessageReaction]
    public var textLinks: [TextLink]? // deprecated
    public var parentChannelId: String
    public var error: Error?

    ...
}
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| chat | ChatImpl | Optional |  | Reference to the main `Chat` protocol. |
| timetoken | Timetoken | Optional |  | Unique identifier for the message, possibly a timestamp or similar value that helps order messages in a conversation. |
| content | EventContent.TextMessageContent | Optional |  | Original text content of the message. |
| channelId | String | Optional |  | Unique identifier for the channel or group in which the message was sent. |
| userId | String | Optional |  | [Unique ID](https://www.pubnub.com/docs/general/setup/users-and-devices) of the user who sent the message. |
| actions | [String: | Optional |  | Any actions associated with the message, such as reactions, replies, or other interactive elements. |
| meta | [String: | Optional |  | Extra information added to the message giving additional context. This object can be of any type and can consist of a list of key-value pairs. For example, `{language: 'English', wordCount: 42}`. |
| mentionedUsers | MessageMentionedUsers | Optional |  | List of mentioned users with IDs and names. |
| referencedChannels | MessageReferencedChannels | Optional |  | List of referenced channels with IDs and names. |
| quotedMessage | QuotedMessage | Optional |  | List of quoted messages with their timetokens, content, and authors' IDs. |
| text | String | Optional |  | Content of the message. |
| deleted | Bool | Optional |  | Whether the message is soft deleted. |
| hasThread | Bool | Optional |  | Whether any thread has been created for this message. |
| type | String | Optional |  | Message type (currently `"text"` for all thread messages). |
| files | [File] | Optional |  | List of attached files with their names, types, and sources. |
| reactions | [MessageReaction] | Optional |  | List of reactions attached to the message. Each `MessageReaction` contains `value`, `isMine`, `userIds`, and a computed `count`. |
| textLinks | [TextLink] | Optional |  | List of included text links and their position. |
| parentChannelId | String | Optional |  | Unique identifier of the main channel on which you create a subchannel (thread channel) and thread messages. |
| error | Error? | Optional |  | Error associated with the message, if any. |

## Methods

You can call the following methods on the `ThreadMessage` object.

Click on each method for more details.

* [pinToParentChannel()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads#pin-thread-message-to-parent-channel)
* [unpinFromParentChannel()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads#unpin-thread-message-from-parent-channel)
* All methods available under the [Message object](https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/message#methods).

## Event listeners

You can call the following event listener methods on the `ThreadMessage` object.

Click on each method for more details.

* [streamUpdatesOn()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads#get-thread-message-updates)
* All event listeners available under the [Message object](https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/message#event-listeners).

## Use case

`ThreadMessage` methods enable:

* Sending messages in [threads](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads)
* [Pinning](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads#pin-thread-message-to-parent-channel) thread messages to the parent channel