OfficeDev / skype-web-sdk-samples

Other
116 stars 75 forks source link

Sending Files Via Instant Messaging #14

Open MikeDev2016 opened 8 years ago

MikeDev2016 commented 8 years ago

I've noticed that within a Conversation's chatService there is no attachments Collection or addAttachment Command. From my understanding, the only way to send an IM is by using the sendMessage Command which only accepts text.

I was wondering if it was currently possible to attach files to messages via the Skype for Web SDK?

Thank you

MikeDev2016 commented 8 years ago

Follow Up

My main goal really is to send images over IM, not necessarily files/attachments.

I've actually been informed that the chatService.sendMessage command accepts either "Text" or "Html" message formats. However, it would appear as though the "Html" message format does not accept img tags, is this true?

I've attempt these two scenarios:

Scenario 1 does not work but if I remove the img tag (i.e. Scenario 2) it works as expected.

antonkh commented 8 years ago

As of today the SDK doesn't support attaching/sending files.

The <img> tags are removed because the SDK tries to remove everything that can potentially cause XSS, e.g. <script> tags. In fact, the SDK has a very short list of allowed tags and <img> is just not one of them.

If the receiver of these messages is also an SDK based app, then you can bypass this filter by sending the image URL as plain text and then transforming it back to <img> on the receiver side.

However I think that we should consider to add a option to disable this filter.

MikeDev2016 commented 8 years ago

Thank you very much for taking the time to answer. I was trying just about everything thinking I was doing something wrong.

I agree that either adding an option to disable this filter, or ideally adding functionality to support attaching/sending files, would be a great idea. I am convinced that there will be more demand for such functionality as the SDK becomes used by more developers over time.

statefull commented 6 years ago

Any update about this?