Skip to main content
The message manager is responsible for CRUD operations on messages, new message listening, refresh message listening, message storage, send message receipt listening, monitoring sync of specific chat data, etc.

Sending Messages

Basic Send Method

Built-in channel types in SDK can be viewed through WKChannelType

Text Messages

Image Messages

When building image message content, there’s no need to pass image width and height. The SDK will automatically get the image dimensions.

Complete Send Example

Custom Messages

See custom messages: Custom Messages

Message Storage Listening

When sending messages, the SDK will trigger a storage callback after saving the message to the local database. At this point, the message has not been sent yet, and you can display the message in the UI in this listener.
For explanation about whether to pass a unique key for events, see Event Listening

New Message Listening

If you receive new messages in a chat page, you need to determine whether the message belongs to the current conversation by checking the channelID and channelType of the message object WKMsg

New Message Handling Example

Message Refresh Listening

When the SDK updates messages, such as: message send status, someone likes a message, message read receipt, message recall, message editing, etc., the SDK will callback the following event. The UI can determine which specific message has changed through the clientMsgNO of the message object WKMsg.

Message Refresh Handling Example

Message Send Status Code (ReasonCode)

When a message is sent, you can obtain the WKMsg object by listening for message refresh events. The status (send status) and reasonCode in WKMsg indicate the result of the message delivery.

View History Messages

Getting history messages is not a synchronous method, as there may be non-continuous data that needs to be synced from the server

Next Steps

Channel Management

Learn how to manage channels and groups

Conversation Management

Handle conversation lists and unread messages

Channel Member Management

Manage channel member information

Data Source Configuration

Configure data sources and sync logic