Assistance Needed – Sending Direct Messages from My Teams App in a Multi-Tenant Setup

Vincent Portier 0 Reputation points
2025-01-30T13:58:04.9166667+00:00

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,

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,775 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,767 questions
Azure Managed Applications
Azure Managed Applications
An Azure service that enables managed service providers, independent software vendors, and enterprise IT teams to deliver turnkey solutions through the Azure Marketplace or service catalog.
161 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,928 questions
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,524 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.