Microsoft.Teams.Apps.BotBuilder
1.0.3
Prefix Reserved
dotnet add package Microsoft.Teams.Apps.BotBuilder --version 1.0.3
NuGet\Install-Package Microsoft.Teams.Apps.BotBuilder -Version 1.0.3
<PackageReference Include="Microsoft.Teams.Apps.BotBuilder" Version="1.0.3" />
<PackageVersion Include="Microsoft.Teams.Apps.BotBuilder" Version="1.0.3" />
<PackageReference Include="Microsoft.Teams.Apps.BotBuilder" />
paket add Microsoft.Teams.Apps.BotBuilder --version 1.0.3
#r "nuget: Microsoft.Teams.Apps.BotBuilder, 1.0.3"
#:package Microsoft.Teams.Apps.BotBuilder@1.0.3
#addin nuget:?package=Microsoft.Teams.Apps.BotBuilder&version=1.0.3
#tool nuget:?package=Microsoft.Teams.Apps.BotBuilder&version=1.0.3
Microsoft.Teams.Apps.BotBuilder
A compatibility bridge that enables existing Bot Framework SDK v4 applications to run on the modern Microsoft Teams Bot Core infrastructure. It implements the Adapter pattern, translating between Bot Framework interfaces and the new Teams Core SDK — allowing migration without rewriting existing bot logic.
Key Features
- Drop-in Adapter —
TeamsBotFrameworkHttpAdapterimplementsIBotFrameworkHttpAdapter, so existing bots work with minimal changes - Full Conversation Support — Send, update, delete activities, manage members, and handle attachments through adapted interfaces
- OAuth Compatibility —
CompatUserTokenClientbridges token management between the two frameworks - Proactive Messaging —
ContinueConversationAsyncfor resuming conversations from external triggers - Teams API Access — Static
TeamsApiClientmethods for Teams-specific operations (meetings, batch messaging, team/channel metadata) - Schema Translation — Bidirectional conversion between Bot Framework and Core activity models
Installation
dotnet add package Microsoft.Teams.Apps.BotBuilder
Quick Start
Register the Adapter
var builder = WebApplication.CreateBuilder(args);
builder.AddTeamsBotFrameworkHttpAdapter();
var app = builder.Build();
// Map your existing IBot implementation to the endpoint
app.MapPost("api/messages", async (HttpContext context) =>
{
var adapter = context.RequestServices
.GetRequiredService<IBotFrameworkHttpAdapter>();
var bot = context.RequestServices.GetRequiredService<IBot>();
await adapter.ProcessAsync(
context.Request, context.Response, bot, context.RequestAborted);
});
app.Run();
Use with an Existing Bot
Your existing IBot implementation works unchanged:
public class MyBot : ActivityHandler
{
protected override async Task OnMessageActivityAsync(
ITurnContext<IMessageActivity> turnContext, CancellationToken ct)
{
await turnContext.SendActivityAsync(
MessageFactory.Text($"Echo: {turnContext.Activity.Text}"), ct);
}
}
// Register your bot
builder.Services.AddTransient<IBot, MyBot>();
Teams-Specific Operations
Use the static TeamsApiClient for Teams APIs within your bot handlers:
// Get a specific member
var member = await TeamsApiClient.GetMemberAsync(turnContext, userId);
// Get team details
var team = await TeamsApiClient.GetTeamDetailsAsync(turnContext);
// Get paginated team members
var members = await TeamsApiClient.GetPagedTeamMembersAsync(turnContext, teamId);
// Meeting info
var meeting = await TeamsApiClient.GetMeetingInfoAsync(turnContext);
// Send notification to a meeting
await TeamsApiClient.SendMeetingNotificationAsync(turnContext, notification);
Batch Messaging
// Send to all users in a team
var operationId = await TeamsApiClient.SendMessageToAllUsersInTeamAsync(
turnContext, activity, teamId, tenantId);
// Send to all users in tenant
var operationId = await TeamsApiClient.SendMessageToAllUsersInTenantAsync(
turnContext, activity, tenantId);
// Check operation status
var state = await TeamsApiClient.GetOperationStateAsync(turnContext, operationId);
// Get failed entries
var failures = await TeamsApiClient.GetPagedFailedEntriesAsync(turnContext, operationId);
Proactive Messaging
var adapter = serviceProvider
.GetRequiredService<IBotFrameworkHttpAdapter>() as TeamsBotFrameworkHttpAdapter;
await adapter!.ContinueConversationAsync(
botId, conversationReference,
async (turnContext, ct) =>
{
await turnContext.SendActivityAsync("Proactive notification!", cancellationToken: ct);
});
Architecture
The library bridges two frameworks through a set of adapter classes:
Bot Framework SDK Teams Bot Core
───────────────── ──────────────
IBotFrameworkHttpAdapter ←──→ TeamsBotFrameworkHttpAdapter
BotAdapter ←──→ TeamsBotAdapter
IConnectorClient ←──→ CompatConnectorClient
IConversations ←──→ CompatConversations → ConversationClient
UserTokenClient ←──→ CompatUserTokenClient → Core UserTokenClient
Activity (BF) ←──→ CoreActivity (ActivitySchemaMapper)
TeamsBotFrameworkHttpAdapterhandles HTTP request/response lifecycle and delegates to the Core SDKCompatConversationsimplementsIConversationsby forwarding calls to the CoreConversationClientCompatUserTokenClientadapts Core token operations to the Bot FrameworkUserTokenClientinterfaceActivitySchemaMapperprovides bidirectional conversion between Bot FrameworkActivityand CoreCoreActivityTeamsApiClientprovides static methods for Teams-specific APIs not covered by standard Bot Framework interfaces
Main Types
| Type | Description |
|---|---|
TeamsBotFrameworkHttpAdapter |
Primary adapter — implements IBotFrameworkHttpAdapter with full HTTP lifecycle |
TeamsBotAdapter |
Base adapter bridging BotAdapter to Teams Core activity processing |
TeamsApiClient |
Static utility for Teams-specific APIs (members, meetings, batch messaging, channels) |
ActivitySchemaMapper |
Bidirectional conversion between Bot Framework and Core activity schemas |
CompatHostingExtensions |
DI registration via AddTeamsBotFrameworkHttpAdapter() |
| 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.Bot.Builder.Integration.AspNet.Core (>= 4.22.3)
- Microsoft.Teams.Core (>= 1.0.3)
-
net8.0
- Microsoft.Bot.Builder.Integration.AspNet.Core (>= 4.22.3)
- Microsoft.Teams.Core (>= 1.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.