Managing Message

Cancel Media Upload#

Using the SDK.cancelMediaUpload() method to cancel or pause an in-progress upload that hasn't yet finished. Once the media upload has been successfully cancelled or paused, you will receive a success response.

const param = {
toJid: "",
messageType: "image", // image|audio|video|document
fileMessageParams: {
file: FILE,
caption: "",
},
replyMessageId: "",
};
SDK.sendMediaFileMessage(param)
.onPending((msgId) => {
await SDK.cancelMediaUpload(msgId);
});

Request Params#

StatusDescriptionTypeRequired
msgIdMessage ID for the MessageStringtrue

Response Format#

{
statusCode: 200,
message: `Media upload for message-id ${msgId} is cancelled`
}
caution

You cannot cancel a media upload once you receive a success or error callback.

Resume Media Upload#

Use below method to resume the media upload.

await SDK.resumeMediaUpload( msgId ,
onResuming((msgId) => {
// ...
}),
.onSuccess((response) => {
// ...
}),
.onError((error) => {
// ...
})
);

Request Params#

StatusDescriptionTypeRequired
msgIdMessage ID for the MessageStringtrue
onResumingResuming call backfunctiontrue
onSuccessResuming uploaded success call backfunctiontrue
onErrorResuming error call backfunctiontrue

Refer Here to know more about resume media upload success. You are the same success callback response for the Send Media File Message method.

Cancel Media Download#

Using the SDK.cancelMediaDownload() method to cancel or pause an in-progress download that hasn't yet finished. Once the media download has been successfully cancelled or paused, you will receive a success response.

SDK.downloadMedia(msgId)
.onPending((msgId) => {
await SDK.cancelMediaDownload(msgId);
});

Request Params#

StatusDescriptionTypeRequired
msgIdMessage ID for the MessageStringtrue

Response Format#

{
statusCode: 200,
message: `Media download for message-id ${msgId} is cancelled.`
}
caution

You cannot cancel a media download once you receive a success or error callback.

Resume Media Download#

Use below method to resume the media download.

await SDK.downloadMedia(msgId,
onResuming((msgId) => {
// ...
}),
.onSuccess((response) => {
// ...
}),
.onError((error) => {
// ...
})
);

Request Params#

StatusDescriptionTypeRequired
msgIdMessage ID for the MessageStringtrue
onResumingResuming call backfunctiontrue
onSuccessResuming uploaded success call backfunctiontrue
onErrorResuming error call backfunctiontrue

Refer Here to know more about resume media download success. You are the same success callback response for the Download Media method.