Thunderbird attachment pane in composer window

Hello! I’m trying to programmatically open the attachment pane (in composer window) from within javascript. Right now I’m using the following code:
compFields.addAttachment(attachmentInfo);

where attachmentInfo is of type var attachmentInfo = Components.classes["@mozilla.org/messengercompose/attachment;1"].createInstance(Components.interfaces.nsIMsgAttachment);

The attachment is added through an URL from the internet
attachmentInfo.url = uploadLink;

The code works perfectly, but it does not show the attachment window after the attachment is added, so practically the user won’t have any feedback as when the upload completes.

Thank you in advance!

I found the answer myself:
This does the magic trick:

toggleAttachmentPane(“show”); //open the pane
var bucket = document.getElementById(“attachmentBucket”);
var item = bucket.appendItem(attachmentInfo); //attachmentInfo is the attachment nsIAttachment
item.image = “moz-icon://message.eml”;
updateAttachmentPane();