Skip to main content

Drafts

The Nexconn SDK supports saving, retrieving, and clearing text message drafts for channels.

Save a draft

Use saveDraft() to save draft content to a channel.

kotlin
val channel = DirectChannel("userId")

channel.saveDraft("Draft content") { success, error ->
if (error == null && success == true) {
Log.d("Draft", "Draft saved")
}
}

Get a draft

Access the draft property on the channel object to retrieve the saved draft text.

kotlin
val channel = DirectChannel("userId")
val draftText = channel.draft
if (!draftText.isNullOrEmpty()) {
Log.d("Draft", "Draft content: $draftText")
} else {
Log.d("Draft", "No draft")
}

Clear a draft

Use clearDraft() to remove the draft from a channel.

kotlin
val channel = DirectChannel("userId")

channel.clearDraft { success, error ->
if (error == null && success == true) {
Log.d("Draft", "Draft cleared")
}
}

Parameters

saveDraft

ParameterTypeDescription
draftStringThe draft text content.
handlerOperationHandler<Boolean>The completion callback.

clearDraft

ParameterTypeDescription
handlerOperationHandler<Boolean>The completion callback.

Important notes

  • Drafts are stored locally only.
  • Each channel holds one draft at a time. A new draft overwrites the previous one.
  • Clear the draft after sending a message.