how do teams bot on channel get attachments?

Itacir Gabral 1 Reputation point
2022-01-27T21:19:18.533+00:00

If you @ an bot on teams's channel it receive the message body. You can also include file attachments in the message.

I'm using bot framework 4.6 for nodejs. The mention message handler:

this.onMessage(async (context, next) => {
  console.dir(context.activity.attachments)
  await next()
}

how the bot can get the midia resources in the message?

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,062 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ChetanSharmamsft 1,026 Reputation points Microsoft Vendor
    2022-01-28T05:38:42.337+00:00

    @Itacir Gabral - There are two ways to send files to and receive files from a bot:

    Use the Microsoft Graph APIs:
    This method works for bots in all Microsoft Teams scopes:
    personal
    channel
    groupchat

    Use the Teams bot APIs: These only support files in personal context.

    Reference doc:
    https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/bots-filesv4#:~:text=%20There%20are%20two%20ways%20to%20send%20files,only%20support%20files%20in%20personal%20context.%20More%20

    Sample link:
    https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/bots-filesv4#code-sample

    Thanks,
    Chetan Sharma


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link.