Skip to main content

Conversation Draft

Save Draft

  • Save a draft message to the specified conversation.
  • Saving a draft updates the sentTime of the conversation, which will move it to the top of the list.

Method


saveDraftMessage(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
draft: string,
callback: IRCIMIWSaveDraftMessageCallback
): Promise<number>;

Parameter Description

ParameterTypeDescription
typeRCIMIWConversationTypeConversation type
targetIdstringConversation ID
channelIdstringChannel ID, only supported for ultra groups. For other conversation types, pass null.
draftstringThe text content of the draft.
callbackIRCIMIWSaveDraftMessageCallbackCallback for the interface invocation result.

Return Value

Return ValueDescription
numberThe status code of the current interface operation. 0 indicates success. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. Refer to the error codes for detailed errors.

Code Example


const callback = {
onDraftMessageSaved: (code: number) => {
//...
},
};
let code = await engine.saveDraftMessage(type, targetId, channelId, draft, callback);

Get Draft

Retrieve the draft content.

Method


getDraftMessage(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWGetDraftMessageCallback
): Promise<number>;

Parameter Description

ParameterTypeDescription
typeRCIMIWConversationTypeConversation type
targetIdstringConversation ID
channelIdstringChannel ID, only supported for ultra groups. For other conversation types, pass null.
callbackIRCIMIWGetDraftMessageCallbackCallback for the interface invocation result.

Return Value

Return ValueDescription
numberThe status code of the current interface operation. 0 indicates success. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. Refer to the error codes for detailed errors.

Code Example


const callback = {
onSuccess: (t: string) => {
//...
},
onError: (code: number) => {
//...
},
};
let code = await engine.getDraftMessage(type, targetId, channelId, callback);

Delete Draft

Clear the draft information for a specific conversation.

Method


clearDraftMessage(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWClearDraftMessageCallback
): Promise<number>;

Parameter Description

ParameterTypeDescription
typeRCIMIWConversationTypeConversation type
targetIdstringConversation ID
channelIdstringChannel ID, only supported for ultra groups. For other conversation types, pass null.
callbackIRCIMIWClearDraftMessageCallbackCallback for the interface invocation result.

Return Value

Return ValueDescription
numberThe status code of the current interface operation. 0 indicates success. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. Refer to the error codes for detailed errors.

Code Example


clearDraftMessage(
type: RCIMIWConversationType,
targetId: string,
channelId: string,
callback: IRCIMIWClearDraftMessageCallback
): Promise<number>;