---
source_url: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/messages/quotes
title: Quoted messages
updated_at: 2026-06-15T12:11:33.733Z
---

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

## Quote message

There is no dedicated method for quoting messages. You must use `sendText()` - the same method you use for [sending text messages](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/messages/send-receive) - and attach the required quoted message information.

### Method signature

Head over to the [sendText() method](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/messages/send-receive) section for details.

### Sample code

Quote the message with the `16200000000000001` timetoken.

```kotlin
channel.getMessage(16200000000000001).async { result ->
    result.onSuccess { message: Message? ->
        if (message != null) {
            channel.sendText("Here's the message I'm talking about", quotedMessage = message).async {
                it.onSuccess {
                    // message sent
                }.onFailure {
                    // message sending failed
                }
            }
        }
    }.onFailure { exception: PubNubException ->
        println("Exception occurred: ${exception.message}")
    }
}
```

## Get quoted message

`quotedMessage` returns the original quoted message.

### Sample code

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

```kotlin
channel.getMessage(16200000000000001).async { result ->
    result.onSuccess { message: Message? ->
        val quote = message?.quotedMessage
        if (quote != null) {
            println("Quoted Message Details:")
            println("Timetoken: ${quote.timetoken}")
            println("Text: ${quote.text}")
            println("User ID: ${quote.userId}")
        } else {
            println("No quoted message found")
        }
    }.onFailure { exception: PubNubException ->
        println("Exception occurred: ${exception.message}")
    }
}
```

`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/kotlin-chat-sdk/learn/chat-entities/message), use the [getMessage() method](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/messages/details#get-message-details) and the timetoken from the quote that you can extract from the [quotedMessage parameter](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/messages/send-receive) added to the published message.