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
Parameter | Type | Description |
---|---|---|
messageOrCommentId | String | Message or Comment id for the attachment. |
attachmentId | String | Attachment id to be downloaded. |
cancelToken | CancelToken (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');