Skip to content

Replace BotBuilder plugin with HTTP adapter#610

Merged
heyitsaamir merged 7 commits into
mainfrom
botbuilder-http-server-adapter
Jun 15, 2026
Merged

Replace BotBuilder plugin with HTTP adapter#610
heyitsaamir merged 7 commits into
mainfrom
botbuilder-http-server-adapter

Conversation

@heyitsaamir

@heyitsaamir heyitsaamir commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Make BotBuilder an HTTP server adapter instead of an App plugin.

Why: BotBuilder participates at the inbound HTTP layer. Modeling it as an adapter keeps App plugin DI cleaner and lets Core/App treat BotBuilder as host integration rather than a privileged plugin that reaches back into the server. This also allows us to clean up our plugin DI that is unnecessarily fairly privileged (eg. why do plugins get access to creds, tokens etc). Doing this allows us to then move toward a more layered architecture (similar to .net), where the "core" layer will be the only "more" priviledged layer (with creds, tokens etc), instead of this information being passed around everywhere.

Migration path:

// Before
new App({
  plugins: [new BotBuilderPlugin({ handler })],
});

// After
new App({
  httpServerAdapter: new BotBuilderAdapter({ handler }),
});

If you already construct a BotBuilder CloudAdapter:

new App({
  httpServerAdapter: new BotBuilderAdapter({ cloudAdapter, handler }),
});

If no cloudAdapter is supplied, BotBuilderAdapter constructs one from explicit credentials, MicrosoftApp* environment variables, or the same CLIENT_ID / CLIENT_SECRET / TENANT_ID env vars used by teams.apps.

Interesting bits:

  • Adds BotBuilderAdapter implementing IHttpServerAdapter.
  • Removes BotBuilderPlugin and its DI dependencies.
  • Cleans up now-unused App plugin DI entries for raw tokens, raw client, metadata, and credentials.

Reviewer tips:

  • Start with packages/botbuilder/src/adapter.ts.
  • The key thing to check is whether the adapter wrapper preserves the previous BotBuilder flow before forwarding to the Teams handler.

Testing:

image

@heyitsaamir
heyitsaamir force-pushed the botbuilder-http-server-adapter branch 7 times, most recently from c66232a to 69bc187 Compare June 8, 2026 05:06
@heyitsaamir
heyitsaamir marked this pull request as ready for review June 8, 2026 21:30
Copilot AI review requested due to automatic review settings June 8, 2026 21:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the @microsoft/teams.botbuilder integration from an App plugin into an IHttpServerAdapter wrapper (BotBuilderAdapter), aiming to keep BotBuilder at the HTTP boundary and simplify/lock down the plugin DI surface in @microsoft/teams.apps.

Changes:

  • Introduces BotBuilderAdapter (implements IHttpServerAdapter) and replaces BotBuilderPlugin.
  • Removes now-unused plugin DI registrations/types (e.g., id/name/manifest/credentials/tokens, raw client injection).
  • Updates the botbuilder example and adds new adapter-focused tests.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/dev/src/plugin.ts Removes optional DI dependencies (id/name) and stops emitting id in devtools metadata.
packages/botbuilder/src/plugin.ts Removes the old BotBuilder plugin implementation.
packages/botbuilder/src/plugin.spec.ts Removes plugin tests in favor of adapter tests.
packages/botbuilder/src/index.ts Re-exports the new adapter entrypoint instead of the plugin.
packages/botbuilder/src/adapter.ts Adds the new HTTP adapter wrapper that runs BotBuilder before forwarding to the Teams handler.
packages/botbuilder/src/adapter.spec.ts Adds unit tests for adapter behavior (invoke handling, env-based adapter construction, fallthrough).
packages/apps/src/types/plugin/decorators/dependency.ts Removes special-cased DI option types for deprecated DI entries.
packages/apps/src/app.ts Stops registering removed DI entries (id/name/manifest/credentials/botToken + raw client).
package-lock.json Updates lockfile to include @microsoft/teams.cards (used by the updated example).
examples/botbuilder/src/index.ts Migrates example from plugin usage to httpServerAdapter: new BotBuilderAdapter(...) and adds invoke-handling demo.
examples/botbuilder/package.json Adds @microsoft/teams.cards dependency for the updated example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/botbuilder/src/adapter.ts
Comment thread packages/botbuilder/src/adapter.ts
Comment thread packages/botbuilder/src/adapter.ts Outdated
@heyitsaamir
heyitsaamir force-pushed the botbuilder-http-server-adapter branch from 69bc187 to 92f1340 Compare June 8, 2026 23:17
@heyitsaamir
heyitsaamir requested review from corinagum and lilyydu June 10, 2026 23:50
Comment thread packages/botbuilder/src/adapter.ts
Comment thread packages/botbuilder/src/adapter.ts Outdated
Comment thread packages/botbuilder/src/adapter.spec.ts
Comment thread packages/botbuilder/src/adapter.ts
Comment thread packages/botbuilder/src/adapter.ts Outdated
…r-adapter

# Conflicts:
#	packages/apps/src/app.ts
#	packages/apps/src/types/plugin/decorators/dependency.ts
#	packages/botbuilder/src/plugin.ts
@heyitsaamir
heyitsaamir added this pull request to the merge queue Jun 15, 2026
Merged via the queue into main with commit e5cbb45 Jun 15, 2026
7 checks passed
@heyitsaamir
heyitsaamir deleted the botbuilder-http-server-adapter branch June 15, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants