Quoted messages

Quoted Messages feature lets users reference previous messages within a conversation. By quoting a message, users can provide additional context or relevant details, ensuring coherence even when referencing older messages.

Quote message

There is no dedicated method for quoting messages. To send a file, you must use sendText() - the same method you use for sending text messages - and attach the required quoted message information.

Method signature

Head over to the sendText() method section for details.

Basic Usage

Quote the message with the 16200000000000001 timetoken.

// Assuming you have all necessary dependencies and a "chat" instance available

let timetoken: Timetoken = 16200000000000001 // Example timetoken

// Fetch the "support" channel
chat?.getChannel(channelId: "support") {
switch $0 {
case let .success(channel):
if let supportChannel = channel {
print("Fetched support channel metadata with ID: \(supportChannel.id)")
// Fetch the specific message with the timetoken in the "support" channel
supportChannel.getHistory(startTimetoken: timetoken, endTimetoken: timetoken, count: 1) {
switch $0 {
case let .success(messages):
if let quotedMessage = messages.messages.first {
show all 43 lines

Get quoted message

You can access the quotedMessage property of the Message object to list the original quoted message.

Basic usage

Return a quote from the message with the 16200000000000001 timetoken.

// Assuming you have all necessary dependencies and a "chat" instance available

let timetoken: Timetoken = 16200000000000001 // Example timetoken

// Fetch the "support" channel
chat?.getChannel(channelId: "support") {
switch $0 {
case let .success(channel):
if let supportChannel = channel {
print("Fetched support channel metadata with ID: \(supportChannel.id)")

// Fetch the specific message with the timetoken in the "support" channel
supportChannel.getHistory(startTimetoken: timetoken, endTimetoken: timetoken, count: 1) {
switch $0 {
case let .success(messages):
show all 37 lines

quotedMessage returns only values for the timetoken, text, and userId parameters. If you want to return the full quoted Message object, use the getMessage() method and the timetoken from the quote that you can extract from the quotedMessage parameter added to the published message.

Last updated on