---
source_url: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/message
title: Message object
updated_at: 2026-06-29T11:46:04.845Z
---

> 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 `Message` interface has the following properties:

```kotlin
interface Message {
    val chat: Chat
    val timetoken: Long
    val content: EventContent.TextMessageContent
    val channelId: String
    val userId: String
    val actions: Map<String, Map<String, List<Action>>>?
    val meta: Map<String, Any>?
    val mentionedUsers: MessageMentionedUsers? // deprecated
    val referencedChannels: MessageReferencedChannels? // deprecated
    val quotedMessage: QuotedMessage?
    val text: String
    val deleted: Boolean
    val hasThread: Boolean
    val files: List<File>
    val reactions: List<MessageReaction>
    val textLinks: List<TextLink>? // deprecated

    ...
}
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| chat | Chat | Optional |  | Reference to the main `Chat` object. |
| timetoken | Long | 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 | Map<String, | Optional |  | Deprecated. Use reactions instead. |
| meta | Map<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 | Boolean | Optional |  | Whether the message is soft deleted. |
| hasThread | Boolean | Optional |  | Whether any thread has been created for this message. |
| files | List<File> | Optional |  | List of attached files with their names, types, and sources. |
| reactions | List<MessageReaction> | Optional |  | List of reactions attached to the message. Each `MessageReaction` contains a `value` (the emoji string), `isMine` (whether the current user added it), `userIds` (list of users who added it), and `count` (number of users). |
| textLinks | List<TextLink> | Optional |  | List of included text links and their position. |

##### Message-related types

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

```kotlin
@Serializable
sealed class EventContent {

    ...

    @Serializable
    @SerialName("text")
    open class TextMessageContent(
        val text: String,
        val files: List<File>? = null,
    ) : EventContent() {
        override fun equals(other: Any?): Boolean {
            if (this === other) return true
            if (other !is TextMessageContent) return false

            if (text != other.text) return false
            if (files != other.files) return false

            return true
        }

        override fun hashCode(): Int {
            var result = text.hashCode()
            result = 31 * result + (files?.hashCode() ?: 0)
            return result
        }

        override fun toString(): String {
            return "TextMessageContent(text='$text', files=$files)"
        }
    }

    class UnknownMessageFormat(val jsonElement: JsonElement) : TextMessageContent("", null)
}
```

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

```kotlin
enum class MessageActionType {
    REACTIONS,
    DELETED,
    EDITED;

    override fun toString(): String {
        return name.lowercase()
    }
}
```

## Methods

The `Message` object exposes the following methods and properties.

### Regular methods

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

### Event listeners

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

## Use case

`Message` methods enable:

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