Browse SDKs · uni-app / uni-app x
SDKsuni-app

Set a conversation draft

OpenIM uni-app / uni-app x SDK guide for Set a conversation draft.

Copy

setConversationDraft() saves a text draft for one local conversation.

import { setConversationDraft } from '@/uni_modules/unix-openim-sdk'

await setConversationDraft({ conversationID, draftText: editorText })

Pass an explicit empty string to clear the draft:

await setConversationDraft({ conversationID, draftText: '' })

State after the call

Promise success means that the draft has been saved. Merge draftText and draftTextTime from onConversationChanged by conversationID; the complete event ownership is on Get the conversation list.

A draft is device-local conversation state and should not be assumed to synchronize to another device. Clear editor memory on logout so an old account's text cannot appear under a new account. Do not store tokens or sensitive transient form state as a conversation draft.