---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/message-draft
title: MessageDraft object
updated_at: 2026-06-29T11:45:42.522Z
---

> 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


# MessageDraft object

`MessageDraft` represents a message that has not been published yet.

`MessageDraft` has the following properties:

```ts
class MessageDraft {
    channel: Channel,
    value: string,
    quotedMessage?: Message,
    config: MessageDraftConfig,
    files?: FileList | File[] | SendFileParameters["file"][];
}
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| channel | Channel | Optional |  | The [channel](https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/channel) the draft message is being created on. |
| value | string | Optional |  | Message that includes [mentions](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/mentions). |
| quotedMessage | Message | Optional |  | Object added to a draft message when you [quote another message](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/quotes). |
| config | MessageDraftConfig | Optional |  | Configuration of the message containing mentions - what is the user source (channel members or app's keyset users), whether the typing indicator is enabled, and what is the maximum number of user names mentioned in one message (the default value is `10` and max is `100`). |
| files | FileList | Optional |  | One or multiple files attached to the draft text message. They can take the form of a read-only `files` [property of the HTML <input /> element](https://developer.mozilla.org/en-US/docs/Web/API/FileList) (when a user has selected one or more files from their device), or through a drag-and-drop operation (`FileList`). Alternatively, that can be an array of file objects (`File[]`) or PubNub-specific [`SendFileParameters["file"][]](/docs/sdks/javascript/api-reference/files#sendfileparameters). |

##### Message draft configuration

The `MessageDraftConfig` type takes the following parameters:

```ts
type MessageDraftConfig = {
    userSuggestionSource: "channel" | "global";
    isTypingIndicatorTriggered: boolean;
    userLimit: number;
    channelLimit: number;
};
```

#### Methods

Available methods:

* [addChangeListener()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#add-message-draft-change-listener)
* [addLinkedText()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/links#add-linked-text)
* [addMention()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#add-message-element)
* [addQuote()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/quotes#quote-message)
* [getMessagePreview()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/links#show-text-link-preview)
* [insertSuggestedMention()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#insert-suggested-message-element)
* [insertText()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#insert-message-text)
* [removeChangeListener()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#remove-message-draft-change-listener)
* [removeLinkedText()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/links#remove-linked-text)
* [removeMention()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#remove-message-element)
* [removeQuote()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/quotes#remove-quoted-message)
* [removeText()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#remove-message-text)
* [send()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#send-a-draft-message)
* [update()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#update-message-text)

## Use case

`MessageDraft` methods enable users to prepare [draft messages](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts#create-a-draft-message) with:

* [Links](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/links)
* [User mentions](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/mentions) with `@`
* [Channel references](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/references) with `#`