Assistance Needed – Sending Direct Messages from My Teams App in a Multi-Tenant Setup
Hello,
I’m developing a native integration between my SaaS platform and Microsoft Teams by building a custom Teams App.
Goal of the Integration:
When a user is mentioned in my SaaS (e.g., using @username), I want to send them a direct message on Teams from my app, notifying them about the mention—without impersonating a Teams user.
Issue:
I’m unable to send a direct message to a user from my app identity without requiring manual installation of the app in the tenant. It seems that before my app can send messages, the organization must manually install it in the Teams app catalog, which is not scalable for a multi-tenant setup.
Current Implementation:
User Authorization & App Installation Flow
- In my SaaS platform, users can enable the Teams integration.
- The user (who must be a Teams admin) is redirected to the OAuth flow to grant admin consent for my app.
- I store the Teams tenant ID after authorization.
Handling Mentions in My SaaS
- My system listens for mentions (@username).
- When a user who has enabled the Teams integration is mentioned, I:
- Authenticate my app with the user’s Teams tenant using the stored tenant ID.
- Find the mentioned user in the Teams tenant (matching by email, assuming it’s the same in both SaaS and Teams).
- Attempt to install my app for the user in Teams programmatically.
- Where It Fails
- The app does not install automatically in the tenant.
- A manual installation by the admin seems required.
- Without this, I cannot send direct messages from my app.
Questions:
Is it possible to send direct messages from my Teams app without requiring manual installation per tenant?
Can my app be installed automatically in a tenant after the admin grants consent during OAuth?
Is there a way to programmatically add my app to the tenant’s app catalog (without manual admin intervention)?
If not, what is the recommended approach for achieving this in a multi-tenant SaaS model where users enable Teams integration from my platform?
I do not want to distribute the app via the Teams App Store; I need installation to happen only when a user enables the integration in my SaaS.
Thanks in advance for your guidance!
Best regards,