---
source_url: https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/quotes
title: Quoted messages
updated_at: 2026-06-16T12:48:54.173Z
---

> 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

Use `sendText()` with the `quotedMessage` parameter to quote a message. This is the same method used for [sending text messages](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/send-receive).

### Method signature

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

### Sample code

:::tip Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
:::

Quote the message with the `16200000000000001` timetoken.

```swift
// Assumes a "ChatImpl" reference named "chat"
let timetoken: Timetoken = 16200000000000001
Task {
  if let channel = try await chat.getChannel(channelId: "support") {
    if let message = try await channel.getMessage(timetoken: timetoken) {
      // Create a message draft and set the quoted message
      let messageDraft = channel.createMessageDraft()
      messageDraft.update(text: "Quoting the message with timetoken \(timetoken)")
      messageDraft.quotedMessage = message
      try await messageDraft.send()
    } else {
      debugPrint("Message with the specified timetoken not found")
    }
  } else {
    debugPrint("Channel not found")
  }
}
```

## Get quoted message

`quotedMessage` returns the original quoted message.

### Sample code

:::tip Sample code
The code samples in Swift Chat SDK focus on asynchronous code execution.
You can also write synchronous code as the parameters are shared between the async and sync methods but we don't provide usage examples of such.
:::

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

```swift
// Assumes a "ChatImpl" reference named "chat"
let timetoken: Timetoken = 16200000000000001
Task {
  if let channel = try await chat.getChannel(channelId: "support") {
    if let message = try await channel.getMessage(timetoken: timetoken) {
      debugPrint("Quoted message: \(String(describing: message.quotedMessage))")
    } else {
      debugPrint("Message with the specified timetoken not found")
    }
  } else {
    debugPrint("Channel not found")
  }
}
```

`quotedMessage` returns only values for the `timetoken`, `text`, and `userId` parameters. To get the full quoted [Message object](https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/message), use the [getMessage() method](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/details#get-message-details) with the timetoken from `quotedMessage`.