microsoft / BotFramework-Services

Microsoft Bot Framework Services
Creative Commons Attribution 4.0 International
38 stars 11 forks source link

[Teams] Images are not accessible when are sent from MS Teams to the bot via message extensions #348

Closed mpelekh closed 1 year ago

mpelekh commented 1 year ago

Images are not accessible when are sent from MS Teams to the bot via message extensions

Steps to reproduce: 1. Use the snipping tool anywhere on your screen. 2. Paste it onto a message in a channel.

Screenshot 2022-09-23 at 15 18 35

3. Send. 4. Send this message to the bot via message extension.

Screenshot 2022-09-23 at 15 21 38

Actual result: The attachments are empty. The bot can't handle the attachment since there is no metadata in the payload to the uploaded attachment. Expected result: The bot has access to the attachment in the payload and can handle it.

Notes:

anishprasad01 commented 1 year ago

Hi @mpelekh,

A few questions:

mpelekh commented 1 year ago

Hi @anishprasad01 !

  • What language are you using?

TypeScript.

  • What are the versions of the relevant packages in your project?

botbuilder: 4.16.0 botframework-connector: 4.16.0 botframework-schema: 4.16.0

  • How is this bot deployed?

The issue is reproducible for the bot application from AppSource as well as for the custom build application. The bot is deployed as a node.js web server built with restify (v. 8.6.1) framework.

  • Does the behavior change depending on which Teams client or conversation you use?

No, it doesn't. The behavior is the same for both Web and for Desktop Teams clients and it doesn't depend on the conversation that is used.

Note: This issue is reproducible in any case when the message extension is used. You can use the "Steps to Reproduce" from the issue description and check the appropriate request in the network tab to see the payload on the message extension invoke.

anishprasad01 commented 1 year ago

I was able to reproduce this behavior. The bot is creating the Hero Card by getting the image from messagePayload.body.content as sent by Teams, and the attachments are indeed empty. You cannot simply access the URL provided in body, for security.

Let me verify if this is expected behavior or not, as that will inform next steps.

anishprasad01 commented 1 year ago

@mpelekh,

Based on what I have heard from Teams and this Teams documentation on messaging extensions, it appears that this functionality is expected behavior, and will not be changed. Further inquiries on this point should be directed to Teams, as we don't control this on the bot side.