---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/message
title: Message object
updated_at: 2026-06-11T11:33:41.085Z
---

> 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

`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/general/setup/users-and-devices) of the user who sent the message. |
| actions | MessageActions | Optional |  | Deprecated. Any actions associated with the message, such as reactions, replies, or other interactive elements. |
| reactions | MessageReaction[] | Optional |  | List of reactions. Each `MessageReaction` has `value` (emoji string), `isMine` (boolean), and `userIds` (string array). |
| meta | object | 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 | 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#data-security) section. |

##### Message-related types

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

* TextMessageContent 1type TextMessageContent = {2 type: MessageType.TEXT;3 text: string;4 files?: {5 name: string;6 id: string;7 url: string;8 type?: string9 }[]
* MessageActions 1type MessageActions = {2 [type: string]: {3 [value: string]: {4 uuid: string;5 actionTimetoken: string | number;6 }[];7 };8}

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

### Event listeners

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

## Use case

`Message` methods enable:

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