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

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

```csharp
public class Message : UniqueChatEntity {
    public string Id { get; protected set; }
    public string MessageText { get; }
    public string OriginalMessageText { get; }
    public string TimeToken { get; }
    public string ChannelId { get; }
    public string UserId { get; }
    public Dictionary<string, object> Meta { get; }
    public bool IsDeleted { get; }
    public List<MentionedUser> MentionedUsers { get; }
    public List<ReferencedChannel> ReferencedChannels { get; }
    public List<TextLink> TextLinks { get; }
    public List<MessageAction> MessageActions { get; }
    public List<MessageAction> Reactions { get; }
    public List<ChatFile> Files { get; }
}
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| Id | string | Optional |  | Unique identifier for the message which is a message timetoken. |
| MessageText | string | Optional |  | Text content of the message. This is the main content sent by the user. |
| OriginalMessageText | string | Optional |  | Original text content of the message, before any edits. |
| TimeToken | string | Optional |  | A timestamp that helps order messages in a conversation. |
| ChannelId | string | Optional |  | Unique identifier for the channel or group in which the message was sent. |
| UserId | string | Optional |  | Unique ID of the user who sent the message. Do not confuse this with the username of the user. |
| Meta | Dictionary<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. |
| IsDeleted | bool | Optional |  | Indicates whether the message has been deleted. If the message has been deleted, this property will be `true`. |
| MentionedUsers | List<MentionedUser> | Optional |  | List of users mentioned in the message. |
| ReferencedChannels | List<ReferencedChannel> | Optional |  | List of channels referenced in the message. |
| TextLinks | List<TextLink> | Optional |  | List of links included in the message. |
| MessageActions | List<MessageAction> | Optional |  | Any action associated with the message (like edited or deleted). |
| Reactions | List<MessageAction> | Optional |  | All message reactions added to the message by other users. |
| Files | List<ChatFile> | Optional |  | List of files attached to the message. Refer to [Files](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/files) for more details. |

##### Message-related types

The message reaction takes the following properties:

```csharp
public struct MessageAction
{
    public PubnubMessageActionType Type;
    public string Value;
    public string TimeToken;
    public string UserId;
}
```

Depending on how a message was manipulated (what action was taken on it), it is assigned a different action type.

```csharp
public enum PubnubMessageActionType
{
    Reaction,
    Receipt,
    Custom,
    Edited,
    Deleted,
    ThreadRootId
}
```

### Events

The `Message` object has the following event:

```csharp
// Event triggered when a message is updated — enabled by StreamUpdates()
public event Action<Message> OnUpdated;
```

#### Example

An event that is triggered when a message is updated by the server.

```csharp
using System.Threading.Tasks;
using PubnubApi;
using PubnubChatApi;
using UnityEngine;

// Configuration
PubnubChatConfig chatConfig = new PubnubChatConfig();
        
PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"))
{
    SubscribeKey = "demo",
    PublishKey = "demo",
    Secure = true
};

// Initialize Unity Chat
var chatResult = await UnityChat.CreateInstance(chatConfig, pnConfiguration);
if (!chatResult.Error)
{
    chat = chatResult.Result;
}
// Get a channel and a message
var channelResult = await chat.GetChannel("my_channel");
if (!channelResult.Error)
{
    var channel = channelResult.Result;
    var messageResult = await channel.GetMessage("message_timetoken");
            
    if (!messageResult.Error)
    {
        var message = messageResult.Result;
                
        message.OnUpdated += (message) =>
        {
            Debug.Log("Message was edited!");
        };
    }
}
```

## Methods

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

Click on each method for more details.

### Standard methods

* [CreateThread()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/threads#create-thread)
* [Delete()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/delete)
* [EditMessageText()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/updates)
* [Forward()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/forward)
* [GetMessageElements()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/drafts#get-message-elements)
* [GetQuotedMessage()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/quotes#get-quoted-message)
* [GetThread()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/threads#get-thread)
* [HasThread()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/threads#check-if-message-starts-thread)
* [HasUserReaction()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/reactions#check-reactions)
* [MessageReactions()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/reactions)
* [Pin()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/pinned#pin)
* [RemoveThread()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/threads#remove-thread)
* [Report()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/moderation#flagreport-messages)
* [Restore()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/restore)
* [ToggleReaction()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/reactions#add--delete)

### Streaming methods

These methods register or unregister real-time event subscriptions. Each streaming method activates one or more of the events listed in the [Events](#events) section above.

* [StreamUpdates()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/updates#get-message-updates)
* [StreamUpdatesOn()](https://www.pubnub.com/docs/chat/unity-chat-sdk/build/features/messages/updates#get-message-updates)

## Use case

`Message` methods enable:

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