In-app Chat
SDK Error Codes
On this page

Set conversation extended data

2026-11-06

Introduction

The conversation extended data (extendedData) is a JSON string customized and maintained by the business side. It can be attached to a conversation to store custom business data of the conversation.

Starting from version 3.3.0, ZIM supports setting extended data for conversations. Once set, the extended data is returned through the extendedData field of ZIMConversation when querying the conversation list or receiving a conversation changed notification.

Note

The conversation extended data and the conversation mark are independent of each other: setting or unsetting a conversation mark does not clear the conversation extended data.

Procedures

Call the setConversationExtendedData interface and pass in a list of ZIMConversationExtendedData (containing the conversation ID, conversation type, and extended data) to set the extended data of multiple conversations in batches. Pass an empty string as extendedData to delete the extended data of the corresponding conversation.

Notes:

  • Only one-on-one and group chat conversations are supported. For other conversation types (such as rooms), the setting fails locally.
  • Even if errorInfo.code in the callback indicates success, you should still check failedConversationInfos; the entries rejected locally are returned in this list.
// Build the conversation extended data list
ZIMConversationExtendedData data = ZIMConversationExtendedData();
data.conversationID = "convId";
data.conversationType = ZIMConversationType.peer;
data.extendedData = '{"key":"value"}';

// Set the conversation extended data
ZIM.getInstance().setConversationExtendedData([data]).then((value){
    // Set successfully. Note that you need to check the conversations that failed to be set in value.failedConversationInfos
}).catchError((onError){
    // You can print the error code and error message to troubleshoot the error cause, referring to the ZIM official website error code documentation
});

Previous

Query a conversation

Next

Set conversation draft

On this page

Back to top