Microsoft.Teams.Apps
v2.1.0-preview-0010Pre-release
net10.0net8.0
Create Microsoft Teams Bot Applications with ease.
Published
Jul 7, 2026
3mo ago
Total Downloads
96.0K
96,006
Install
dotnet add package Microsoft.Teams.Apps --version 2.1.0-preview-0010
| Product | Versions |
|---|---|
| .NET |
README
Microsoft.Teams.Apps
A high-level framework for building Microsoft Teams bots in .NET. Built on top of Microsoft.Teams.Core, it provides Teams-specific activity types, a typed routing and handler system, OAuth authentication flows, Teams API clients, and streaming message support.
Key Features
- Typed Activity Routing — Register handlers for specific activity types (
OnMessage,OnAdaptiveCardAction,OnQuery, etc.) with type-safe contexts - Teams Activity Schema — Rich type hierarchy (
MessageActivity,InvokeActivity<T>,ConversationUpdateActivity, etc.) with polymorphic deserialization - OAuth Flows — Built-in SSO token exchange, sign-in cards, and token management via
OAuthFlow - Teams API Clients — Typed clients for conversations, members, teams, channels, meetings, and batch operations
- Streaming Messages — Progressive response updates via
TeamsStreamingWriter - Fluent Configuration — Chainable handler registration and
AppBuilderfor setup
Installation
dotnet add package Microsoft.Teams.Apps
Quick Start
using Microsoft.Teams.Apps;
using Microsoft.Teams.Apps.Handlers;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddTeamsBotApplication();
var app = builder.Build();
var teams = app.UseTeamsBotApplication(); // maps POST /api/messages
teams.OnMessage(async (context, ct) =>
{
await context.SendActivityAsync($"You said: {context.Activity.Text}", ct);
});
app.Run();
Handler Registration
Handlers are registered as extension methods on TeamsBotApplication and can be chained:
Messages
using Microsoft.Teams.Apps.Handlers;
// All messages
teams.OnMessage(async (context, ct) => { ... });
// Regex pattern match
teams.OnMessage(@"^help$", async (context, ct) =>
{
await context.SendAsync("Here's how to use the bot...");
});
Invoke Activities
// Adaptive card actions
teams.OnAdaptiveCardAction(async (context, ct) =>
{
var value = context.Activity.Value;
return new InvokeResponse(200);
});
// Message extension search
teams.OnQuery(async (context, ct) =>
{
var query = context.Activity.Value.Parameters["queryText"];
return new InvokeResponse<MessageExtensionResponse>(200, response);
});
// Task modules
teams.OnFetchTask(async (context, ct) => { ... });
teams.OnTaskSubmit(async (context, ct) => { ... });
// Link unfurling
teams.OnQueryLink(async (context, ct) => { ... });
Main Types
| Type | Description |
|---|---|
TeamsBotApplication |
Main entry point — extends BotApplication with Teams-specific routing and features |
Context<TActivity> |
Per-turn context providing typed activity access, API clients, and helper methods |
TeamsActivity |
Base Teams activity with polymorphic deserialization into specific subtypes |
MessageActivity |
Text and attachment messages |
InvokeActivity<T> |
Invoke operations (adaptive cards, task modules, message extensions) |
ConversationUpdateActivity |
Membership, channel, and team lifecycle events |
OAuthFlow |
OAuth sign-in, token exchange (SSO), and sign-out management |
ApiClient |
Facade for Teams conversation, member, team, meeting, and bot APIs |
TeamsStreamingWriter |
Progressive message streaming with rate limiting |
Router |
Internal activity dispatcher matching routes by type and selector |
Changes from Previous Version
No structural changes between v2.1.0-preview-0009 and v2.1.0-preview-0010.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.