---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/message
title: Message object
updated_at: 2026-09-30T07:20:08.000Z
---

# Message object

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

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

## Properties

`Message` has the following properties:

```ts
class Message {
    timetoken: string,
    content: TextMessageContent,
    channelId: string,
    userId: string,
    actions?: MessageActions,
    reactions?: MessageReaction[],
    meta?: {
        [key: string]: any
    },
    error?: string
}
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| timetoken | string | Optional |  | Unique identifier for the message, possibly a timestamp or similar value that helps order messages in a conversation. |
| content | 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/architecture/core-concepts.md) of the user who sent the message. |
| actions | MessageActions or undefined | Optional |  | Deprecated. Any actions associated with the message, such as reactions, replies, or other interactive elements. |
| reactions | MessageReaction[] or undefined | Optional |  | List of reactions. Each `MessageReaction` has `value` (emoji string), `isMine` (boolean), and `userIds` (string array). |
| meta | object or undefined | 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}`. |
| error | string or undefined | Optional |  | Error added to the message when either the message or files it contains couldn't be decrypted. For more information, refer to the [Data security](https://www.pubnub.com/docs/chat/chat-sdk/learn/access-control.md#data-security) section. |

##### Message-related types

The message and message action types defined for the `Message` object take the following parameters:

* `TextMessageContent`

   ```ts
   type TextMessageContent = {
       type: MessageType.TEXT;
       text: string;
       files?: {
           name: string;
           id: string;
           url: string;
           type?: string
       }[]
   ```

* `MessageActions`

   ```ts
   type MessageActions = {
       [type: string]: {
           [value: string]: {
               uuid: string;
               actionTimetoken: string | number;
           }[];
       };
   }
   ```

A single text message has the `text` type.

```ts
export enum MessageType {
  TEXT = "text"
}
```

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

```ts
export enum MessageActionType {
  REACTIONS = "reactions",
  DELETED = "deleted",
  EDITED = "edited",
}
```

## Methods

Available methods:

### Regular methods

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

### Event listeners

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

## Use case

`Message` methods enable:

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

Last updated at: 2026-09-30T07:20:08.000Z
