I'm using a Circuit JS SDK and want to send message with attached image. I found on documentation that I should set the item.attachments to File[] object. But how can I do it if I have only image URL (like https://abc.cde/fgh.png)?
Send image in attachments by URL in Circuit JS SDK
64 views Asked by Andrey Klenchischev At
1
To be able to post an image in a conversation, the image needs to be uploaded to Circuit which is done internally in the
addTextItemAPI as you already found out. And yes this API takes an array ofFileobjects.You will need to download the image via XMLHttpRequest as blob and then construct a File object.
Here is a jsbin https://output.jsbin.com/sumarub