Microsoft.Teams.Core
1.0.2
Prefix Reserved
dotnet add package Microsoft.Teams.Core --version 1.0.2
NuGet\Install-Package Microsoft.Teams.Core -Version 1.0.2
<PackageReference Include="Microsoft.Teams.Core" Version="1.0.2" />
<PackageVersion Include="Microsoft.Teams.Core" Version="1.0.2" />
<PackageReference Include="Microsoft.Teams.Core" />
paket add Microsoft.Teams.Core --version 1.0.2
#r "nuget: Microsoft.Teams.Core, 1.0.2"
#:package Microsoft.Teams.Core@1.0.2
#addin nuget:?package=Microsoft.Teams.Core&version=1.0.2
#tool nuget:?package=Microsoft.Teams.Core&version=1.0.2
Microsoft.Teams.Core
The foundational .NET library for building Microsoft Teams bots. It implements the Activity Protocol, providing the core bot application framework, conversation client, user token client, middleware pipeline, and support for both Bot and Agentic identities.
Key Features
- Activity Processing — Receive, deserialize, and dispatch activities through a middleware pipeline
- Conversation Client — Send, update, and delete activities; manage conversation members and metadata
- User Token Client — OAuth token management, sign-in flows, and token exchange (SSO)
- Middleware Pipeline — Extensible
ITurnMiddlewarechain for cross-cutting concerns - Flexible Authentication — Client secrets, managed identities (system/user-assigned), federated identities, and agentic (user-delegated) tokens via MSAL
- Extensible Schema — Loose
CoreActivitymodel withJsonExtensionDatafor channel-specific properties - AOT-Compatible — Source-generated JSON serialization via
CoreActivityJsonContext
Installation
dotnet add package Microsoft.Teams.Core
Quick Start
Register Services & Map Endpoint
var builder = WebApplication.CreateBuilder(args);
builder.AddBotApplication();
var app = builder.Build();
var bot = app.UseBotApplication(); // maps POST /api/messages
bot.OnActivity = async (activity, ct) =>
{
if (activity.Type == ActivityType.Message)
{
var reply = CoreActivity.CreateBuilder()
.WithType(ActivityType.Message)
.WithConversation(activity.Conversation)
.WithServiceUrl(activity.ServiceUrl)
.WithProperty("text", "Hello from the bot!")
.Build();
await bot.SendActivityAsync(reply, ct);
}
};
app.Run();
Custom Bot Subclass
public class MyBot : BotApplication
{
public MyBot(
ConversationClient conversationClient,
UserTokenClient tokenClient,
ILogger<MyBot> logger)
: base(conversationClient, tokenClient, logger)
{
OnActivity = HandleActivityAsync;
}
private async Task HandleActivityAsync(CoreActivity activity, CancellationToken ct)
{
// your logic here
}
}
// Registration
builder.AddBotApplication<MyBot>();
var bot = app.UseBotApplication<MyBot>();
Middleware
public class LoggingMiddleware : ITurnMiddleware
{
public async Task OnTurnAsync(
BotApplication bot, CoreActivity activity, NextTurn next, CancellationToken ct)
{
Console.WriteLine($"Activity: {activity.Type} from {activity.From?.Name}");
await next(ct);
}
}
bot.UseMiddleware(new LoggingMiddleware());
Extensible Activity Schema
public class MyChannelData : ChannelData
{
[JsonPropertyName("customField")]
public string? CustomField { get; set; }
}
public class MyActivity : CoreActivity
{
[JsonPropertyName("channelData")]
public new MyChannelData? ChannelData { get; set; }
}
Configuration
Provide credentials via appsettings.json:
{
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"TenantId": "<your-tenant-id>",
"ClientId": "<your-client-id>",
"Scope": "https://api.botframework.com/.default",
"ClientCredentials": [
{
"SourceType": "ClientSecret",
"ClientSecret": "<your-secret>"
}
]
}
}
Or via environment variables:
AzureAd__TenantId=<your-tenant-id>
AzureAd__ClientId=<your-client-id>
AzureAd__ClientCredentials__0__SourceType=ClientSecret
AzureAd__ClientCredentials__0__ClientSecret=<your-secret>
When no MSAL configuration is provided, communication happens as anonymous REST calls, suitable for localhost testing.
Design Principles
- Loose schema —
CoreActivitycontains only strictly required fields; additional fields are captured viaJsonExtensionData - Simple serialization — No custom converters; standard
System.Text.Jsonwith source generation - Extensible schema —
ChannelDataandConversationAccountsupport extension properties; generics allow custom types - MSAL-based auth — Token acquisition built on top of Microsoft Identity Web
- ASP.NET DI — All dependencies configured via
IServiceCollectionextensions, reusing the existingHttpClientfactory - ILogger & IConfiguration — Standard .NET logging and configuration throughout
Main Types
| Type | Description |
|---|---|
BotApplication |
Core entry point — processes HTTP requests, runs middleware, dispatches to handlers |
ConversationClient |
HTTP client for Bot Framework conversation APIs (send, update, delete, members) |
UserTokenClient |
HTTP client for Bot Framework Token Service (OAuth, SSO, sign-in) |
CoreActivity |
Activity data model following the Activity Protocol specification |
CoreActivityBuilder |
Fluent builder for constructing CoreActivity instances |
ITurnMiddleware |
Interface for middleware in the activity processing pipeline |
AgenticIdentity |
Represents user-delegated token acquisition identity |
BotHandlerException |
Exception wrapper preserving the activity that caused the error |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.6)
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 10.0.6)
- Microsoft.AspNetCore.DataProtection (>= 10.0.7)
- Microsoft.Identity.Web.AgentIdentities (>= 4.8.0)
- Microsoft.Identity.Web.UI (>= 4.8.0)
-
net8.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.22)
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 8.0.22)
- Microsoft.AspNetCore.DataProtection (>= 10.0.7)
- Microsoft.Identity.Web.AgentIdentities (>= 4.8.0)
- Microsoft.Identity.Web.UI (>= 4.8.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Microsoft.Teams.Core:
| Package | Downloads |
|---|---|
|
Microsoft.Teams.Apps
Create Microsoft Teams Bot Applications with ease. |
|
|
Microsoft.Teams.Apps.BotBuilder
Bridge to support smooth migration from BotFramework SDK into Teams SDK. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2 | 129 | 5/15/2026 |