🔥Building a Teams Bot with AI Capabilities - Part 6 - Reading Teams Attachments🔥
aka, file location and permissions aren't reliable, and are critically important. Great.
This blog series focuses on presenting complex DevOps projects as simple and approachable via plain language and lots of pictures. You can do it!
These articles are supported by readers, please consider subscribing to support me writing more of these articles <3 :)
This article is part of a series of articles, because 1 article would be absolutely massive.
Part 3: Delegated Permissions and Making Lambda Stateful for Oauth2
Part 4: Building the Receiver lambda to store tokens and state
Part 6 (this article): Finding attachments and reading them into Bedrock
Hey all!
In the last article we talked about how to find the root of messages to build our conversational context in Teams. That is an incredibly challenging task, as the Teams client is several raccoons in a trench coat (well, service APIs behind a front-end, same difference). Those services are generally:
Azure Entra/AD API - Authentication and Authorization (is Teams license assigned)
OneDrive API - personal files. Files are shared to the person they are sent to automatically in Teams.
There is some weird behavior because of this. When building a multi-person chat, and sharing files, files are shared to each person in the chat at the time of sharing the file. If a person is added later, they can see previous messages (Teams API) but not previous files (OneDrive API), as files are not batch retroactively shared. #WeirdTeams
SharePoint API - Team/Channel files. When files are uploaded to a Channel, they are shared with that Team automatically.

To solve this, we have a robust couple functions that find, download, and encode properly the attachments that need to be added to the conversation context.
Lets walk through it.
Keep reading with a 7-day free trial
Subscribe to Let's Do DevOps to keep reading this post and get 7 days of free access to the full post archives.