/ SDKs / Android
SDKs
Chat SDKs Android v4
Chat SDKs Android
Chat SDKs
Android
Version 4

Update a scheduled message

Copy link

You can update a scheduled user message by passing ScheduledUserMessageUpdateParams as an argument to the updateScheduledUserMessage() method.

KotlinKTX
// Updates a scheduled user message.
val params = ScheduledUserMessageUpdateParams().apply {
    scheduledAt = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5)
    message = "Text message"
    translationTargetLanguages = listOf("en", "ko")
    data = null
    customType = null
    mentionType = MentionType.USERS
    mentionedUserIds = listOf(MENTIONED_USER_ID)
    metaArrays = null
    appleCriticalAlertOptions = null
    pushNotificationDeliveryOption = null
}

groupChannel.updateScheduledUserMessage(scheduledMessageId, params) { scheduledUserMessage, e ->
    if (e != null) {
        // Handle error.
    }

    // A scheduled user message has been successfully updated.
}

You can also update a scheduled file message to send at a later time by passing ScheduledFileMessageUpdateParams as an argument to the updateScheduledFileMessage() method.

KotlinKTX
// Updates a scheduled file message.
val params = ScheduledFileMessageUpdateParams().apply {
    scheduledAt = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(5)
    // Set `fileUrl` or `file` exclusively.
    fileUrl = FILE_URL
    file = FILE

    fileName = "Name of the file"
    mimeType = MIME_TYPE
    fileSize = FILE_SIZE
    thumbnailSizes = listOf(ThumbnailSize(THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT))
    data = null
    customType = null
    mentionType = MentionType.USERS
    mentionedUserIds = listOf(MENTIONED_USER_ID)
    metaArrays = null
    appleCriticalAlertOptions = null
    pushNotificationDeliveryOption = null
}

groupChannel.updateScheduledFileMessage(scheduledMessageId, params) { scheduledFileMessage, e ->
    if (e != null) {
        // Handle error.
    }

    // A scheduled file message has been successfully updated.
}