microsoft / botbuilder-dotnet

Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
https://github.com/Microsoft/botframework
MIT License
872 stars 479 forks source link

File attachments are not sent in Teams team chat threads #6710

Closed jamesemann closed 8 months ago

jamesemann commented 10 months ago

Version

Latest

Describe the bug

File attachments are not sent to the bot endpoint when in a teams team chat thread.

To Reproduce

  1. Setup a teams bot
  2. Use ngrok or any tool to inspect the inbound request
  3. Interact with the bot in a teams team channel
  4. Inspect the payload, the attachments fields is not populated with the file metadata

Expected behavior

It should populate the attachment field with the uploaded file. I've included the json payloads for both teams team chat (which doesn't work) and direct messaging the bot (which does work)

Teams team chat (incorrect behaviour):

{
    "attachments": [
        {
            "contentType": "text/html",
            "content": ""
        }
    ],
    "type": "message",
    "timestamp": "2023-12-07T22:56:31.6125661Z",
    "localTimestamp": "2023-12-07T22:56:31.6125661+00:00",
    "id": "1701989791591",
    "channelId": "msteams",
    "serviceUrl": "https://smba.trafficmanager.net/amer/",
    ... (rest of payload hidden)
}

Direct message (correct behaviour):

{
    "attachments": [
        {
            "contentType": "application/vnd.microsoft.teams.file.download.info",
            "content": {
                "downloadUrl": "https://<hidden>",
                "uniqueId": "747d264b-df44-4ccf-b7f4-69c7ca2fd9f4",
                "fileType": "txt"
            },
            "contentUrl": "https://<hidden>",
            "name": "textfile_1MB 2.txt"
        },
        {
            "contentType": "text/html",
            "content": ""
        }
    ],
    "type": "message",
    "timestamp": "2023-12-07T23:01:59.3361783Z",
    "localTimestamp": "2023-12-07T23:01:59.3361783+00:00",
    "id": "1701990119315",
    "channelId": "msteams",
    "serviceUrl": "https://smba.trafficmanager.net/amer/",
    ... (rest of payload hidden)
}

Screenshots

None

Additional context

None

jamesemann commented 9 months ago

Hi @tracyboehrer, would your team be able to triage please

ceciliaavila commented 9 months ago

Hi @jamesemann, according to Teams' documentation, sending and receiving files through the Teams bot API is only supported in personal scope. image