Forum Discussion
Azure teams bot: how to receive files in a group chat
We have a teams bot in our organization. In a personal chat we are able to get an attachment activity with the sharepoint downloadUrl when we upload a file in the chat, but when we try to add this bot to a group and upload an image, we get an empty activity without any image data - {"contentType":"text/html","content":""}.
Is it possible to upload an image in a group, and get it in our webhook as an attachment?
As I read, Teams bot API only supports files in personal context, but what are the alternatives to get it in the webhook?
2 Replies
- Prasad_Das-MSFT
Microsoft
chisr - Teams bot API only support files in
personal
context. However, you can use Microsoft Graph which works for bots in all Microsoft Teams scopes:personal
channel
groupchat
Using Graph API, you can post messages with card attachments that refer to existing SharePoint files, using the Graph APIs for OneDrive and SharePoint.
Ref: Send and receive files using bot - Teams | Microsoft Learn
Send chatMessage in a channel or a chat - Microsoft Graph beta | Microsoft LearnThanks,
Prasad Das
------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
- chisrCopper ContributorThanks. I already found a solution. When we get an empty attachment in the webhook, we send a request 'chats/${chatId}/messages/${messageId}/attachments' and I got the url.