Skip to main content

Is there a way to preview a message attachment from the Sidebar plugin, for example using the plugin SDK downloadAttachment()?

I am currently only getting a File object returned from Front.downloadAttachment('msg_xxx', 'fil_xxx') with the following properties:


lastModified:  1740416909060
lastModifiedDate:  Mon Feb 24 2025 18:08:29 GMT+0100 (Central European Standard Time) {}
name: "fd880b5930634b94bfa961a2b3815db2.jpg"
size:  293622
type:  "image/jpeg"
webkitRelativePath: ""

That SDK method is what you’ll want to use. It delivers the raw attachment content, so you can present it using whatever method you like as a preview. 

Front does not currently provide any built-in tooling to render a file preview, so you can use whatever tool you’re already familiar with to render your preview. 


This opens an attachment in a new window/tab.

Front.downloadAttachment(message.id, attachment.id)
.then(blob => {
const fileURL = URL.createObjectURL(blob);
window.open(fileURL, '_blank'); // Opens in a new tab
})
.catch(error => {
console.error('Error fetching attachment:', error);
});

 


Reply