Chat / iOS
Chat iOS v4
Chat iOS
Chat
iOS
Home
/
Chat
/
iOS
/
Message
This is the new Docs for Chat SDK v4 for iOS. To see the previous Docs, click here.

Retrieve a message

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

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

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

let lastMessage = channel.lastMessage