downloadAttachment

Since Attachments that are returned as part of the Message or Comment contain only metadata about the attachment, this method enables the downloading of the content of that attachment.

📘

This function is only available on context of type singleConversation.

function downloadAttachment(messageOrCommentId: string, attachmentId: string, cancelToken?: CancelToken): Promise<File | undefined>;

Parameters

ParameterTypeDescription
messageOrCommentIdStringMessage or Comment id for the attachment.
attachmentIdStringAttachment id to be downloaded.
cancelTokenCancelToken (optional)Token to cancel the request.

Return value

The function returns a Promise that resolves with either a File containing the attachment data or undefined if it failed to fetch the attachment data.

Examples

Front.downloadAttachment('msg_xxx', 'fil_xxx');