Hi Karlis R,
Thanks for getting in touch with your question about handling file uploads in a custom Copilot agent using the Teams-AI Python SDK.
You noted that when users upload files through Microsoft Teams, your backend only receives the file name as plain text, without any associated metadata or file content.
Steps.
How Teams Handles File Uploads Teams doesn't send the actual file to the bot directly. Instead, it typically sends metadata or a file consent card. Your bot must recognize the attachment and retrieve the file using the included downloadUrl
.
Python SDK Constraints Currently, the Python SDK doesn't fully support all Teams features, including comprehensive file handling in custom Copilot agents. This limitation could be why your bot isn’t receiving complete file data.
Steps to Properly Handle File Uploads:
- Confirm that your bot is set up to accept file attachments.
Inspect incoming activities for an attachments
array.
Identify file-type messages by checking for content types like application/vnd.microsoft.teams.file.download.info
.
Use the content.downloadUrl
to retrieve the file (note: authentication may be required).
Useful Resources
Sending and receiving files with bots in Teams
File upload and download scenarios with bots
If you're looking for full file handling support with Copilot, I’d recommend using the Node.js SDK, which currently offers more complete integration.
Thanks,
Karan Shewale.
*************************************************************************
If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.