logo
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 onConversationChanged callback interface to get the updated conversation information.

Untitled
// Set a draft for a conversation
// Take a group conversation as an example
zim->setConversationDraft("draft", "Group_ID", zim::ZIM_CONVERSATION_TYPE_GROUP, [=](const std::string& conversationID, zim::ZIMConversationType conversationType, const zim::ZIMError& errorInfo) {
	// Operation result
	if (errorInfo.code == zim::ZIM_ERROR_CODE_SUCCESS) {
		// Operation succeeded
	} else {
        // Operation failed, you can print the error code and error message and troubleshoot the error by looking for the ZEGOCLOUD official error code documentation. 
	}
});
1
Copied!

Previous

Query a conversation

Next

Mark conversations