---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/quotes
title: Quoted messages
updated_at: 2026-06-05T11:09:17.524Z
---

> 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


# Quoted messages

Quote previous messages to provide context when responding to older messages in a conversation.

## Interactive demo

See quoting and [threads](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/threads) in a React app.

:::tip Want to implement something similar?
See [how to](https://www.pubnub.com/how-to/chat-sdk-create-threads-and-quote-messges/) or view the [source code](https://github.com/PubNubDevelopers/Chat-SDK-How-Tos/tree/main/threads-quotes).
:::

### Test it out

Click **Reset App State Globally** to clear all previously added quotes and replies (if there are any).

Quote a sample message by pressing the **Quote** button, type in a reply, and press the arrow to send it.

## Quote message

`addQuote()` adds a quoted message to a [message draft](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts).

:::note Direct assignment
Alternatively, assign directly to `messageDraft.quotedMessage`.
:::

### Method signature

```ts
messageDraft.addQuote(message: Message): void;
```

#### Input

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| message | Message | Yes |  | Message you want to quote. |

#### Output

| Type | Description |
| --- | --- |
| `void` | Method returns no output data. |

#### Errors

You will receive the `You cannot quote messages from other channels` error whenever you try to quote a message from another channel.

### Sample code

Quote the message with the `16200000000000001` timetoken.

```ts
// return the message object
const message = await channel.getMessage("16200000000000001")
//add quote to the message
messageDraft.addQuote(message)
```

## Get quoted message

`quotedMessage` returns the original quoted message.

### Method signature

This method has the following signature:

```ts
message.quotedMessage: {
  timetoken: string,
  text: string,
  userId: string
}
```

#### Properties

| Property | Description |
| --- | --- |
| `timetoken`Type: `string` | Timetoken of the orginal message that you quote. |
| `text`Type: `string` | Original message content. |
| `userId`Type: `string` | [Unique ID](https://www.pubnub.com/docs/general/setup/users-and-devices) that identifies the user who published the quoted message. |

### Sample code

Return a quote from the message with the `16200000000000001` timetoken.

```ts
// return the message object
const message = await channel.getMessage("16200000000000001")
// return quote from the message
message.quotedMessage
```

`quotedMessage` returns only values for the `timetoken`, `text`, and `userId` parameters. If you want to return the full quoted [Message object](https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/message), use the `getMessage()` method and the timetoken from the quote that you can extract from the [quotedMessage parameter](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/send-receive) added to the published message:

```ts
const quotedMessageObject = await channel.getMessage(quotedMessage.timetoken)
```

## Remove quoted message

`removeQuote()` removes the quote from a [draft message](https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/drafts).

:::note Direct assignment
Alternatively, set `messageDraft.quotedMessage = null`.
:::

### Method signature

This method has the following signature:

```ts
messageDraft.removeQuote(): void;
```

#### Input

This method doesn't take any parameters.

#### Output

| Type | Description |
| --- | --- |
| `void` | Method returns no output data. |

### Sample code

Remove a quote from the draft message.

```ts
messageDraft.removeQuote()
```