---
source_url: https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/message
title: Message object
updated_at: 2026-05-25T11:25:48.600Z
---

> 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


# Message object

`Message` represents a single message published on a chat channel.

## Properties

The `MessageImpl` class implements the `Message` protocol and takes the following properties:

```swift
extension MessageImpl: Message {
    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]]]?
    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 files: [File]
    public var reactions: [MessageReaction]
    public var textLinks: [TextLink]? // deprecated

    ...
}
```

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

##### Message-related types

The `TextMessageContent` type defined for the `MessageImpl` object takes the following parameters:

```swift
public class TextMessageContent: EventContent {
  public let text: String
  public let files: [File]?
   
  public init(text: String, files: [File]? = nil) {
    self.text = text
    self.files = files
  }
   
}
```

Depending on how a message was manipulated (what action was taken on it), it is assigned a different action type (for adding a message reaction to a message, editing, or deleting a message). For example, `MessageActionType.edited`.

```swift
public enum MessageActionType: String {
  case reactions
  case deleted
  case edited
}
```

## Methods

You can call the following methods and properties on the `Message` object.

Click on each method or property for more details.

* [createThreadMessageDraft()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#create-a-thread-message-draft)
* [createThread()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads#create-thread)
* [delete()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/delete)
* [deleted](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/details#check-deletion-status)
* [editText()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/updates#edit-messages)
* [forward()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/forward)
* [getMessageElements()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/links#get-text-links)
* [getThread()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads#get-thread)
* [hasThread](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads#check-if-message-starts-thread)
* [hasUserReaction()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/reactions#check)
* [pin()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/pinned#pin)
* [quotedMessage](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/quotes#get-quoted-message)
* [reactions](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/reactions#get-reactions-for-one-message)
* [removeThread()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/threads#remove-thread)
* [report()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/moderation#flagreport-messages)
* [restore()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/restore)
* [text](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/details#get-message-content)
* textlinks (deprecated — use `getMessageElements()`)
* [toggleReaction()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/reactions#add--delete)

## Event listeners

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

Click on each method for more details.

* [onUpdated()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/updates#get-message-updates)
* [streamUpdatesOn()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/updates#get-message-updates)

## Use case

`Message` methods enable:

* [Updating](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/updates) and [deleting](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/delete) messages
* [Forwarding](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/forward) messages to others
* [Pinning](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/pinned) messages to channels
* [Quoting](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/quotes) messages
* [Reacting](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/reactions) to messages
* [Reporting](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/moderation#flagreport-messages) offensive messages