/ SDKs / iOS
SDKs
Chat SDKs iOS v4
Chat SDKs iOS
Chat SDKs
iOS
Version 4

Retrieve a message

Copy link

You can retrieve a specific message in an open or group channel by creating and passing the MessageRetrievalParams object as an argument into the getMessage(params:completionHandler:) method.

// Create a MessageRetrievalParams object.
let params = MessageRetrievalParams()
params.messageId = MESSAGE_ID
params.channelType = CHANNEL_TYPE
params.channelURL = CHANNEL_URL

// Pass the params to the parameter of the `getMessage(params:completionHandler:)` method.
BaseMessage.getMessage(params: params) { (message, error) in
    guard error == nil else {
        // Handle error.
        return 
    }

    // The specified message is successfully retrieved.
}

List of properties

Copy link
Property nameTypeDescription

messageId

Int64

Specifies the unique ID of the message.

channelType

ChannelType

Specifies the type of the channel.

channelURL

String

Specifies the URL of the channel.


Retrieve the last message of a group channel

Copy link

You can retrieve and view the last message of a group channel.

let lastMessage = channel.lastMessage