Search code examples
microsoft-graph-apibotframeworkmicrosoft-teamsmicrosoft-graph-teamsmicrosoft-teams-js

How to handle scalability when sending DM with BotFramework


`I’ve exposed a route in my bot framework server to send direct messages (DMs) to users from my backend. I'm attaching images showing the exact code I'm using to send the messages.

My app is multi-tenant and has seen many installs, which has led to issues. Often, sending a message fails due to load, user not being found, or internal server errors.

Is there a better or simpler approach to sending direct messages to Microsoft Teams users in this scenario?

Here are the code images:

image 1 image 2 image 3`


Solution

  • In a multi-tenant app where direct messages (DMs) to Microsoft Teams users are failing due to load, user not being found, or internal server errors.

    If sending messages in bulk, try to process the messages in batches. This avoids overwhelming the bot framework or the Microsoft Graph API, reducing server load and mitigating potential rate-limiting issues.

    Here is sample for reference-https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/bot-conversation/nodejs