logo
In-app Chat
SDK Error Codes
Powered Byspreading
On this page

Set conversation draft


Introduction

A conversation draft refers to a text message that the user is currently editing but has not yet sent. ZIM supports saving conversation drafts locally even after the user exits the conversation, so that the user can continue editing.

Procedures

By calling the setConversationDraft interface and specifying the conversation ID and conversation type, you can save the draft to the conversation.

Note

To clear the conversation draft, pass an empty string for the draft field.

After successfully saving the draft, you can use the conversationChanged callback interface to get the updated conversation information.

Untitled
// Set a draft for a conversation
// Take a group conversation as an example
[[ZIM getInstance] setConversationDraft:@"targetConversationID" conversationType:ZIMConversationTypeGroup callback:^(ZIMError * _Nonnull errorInfo) {
    // The result of saving the conversation draft
    if (errorInfo.code == ZIMErrorCodeSuccess) {
        // Business logic after successful saving
    }
    else {
        // Please refer to the error code documentation for troubleshooting suggestions
    }
}];
1
Copied!

Previous

Query a conversation

Next

Mark conversations