Skip to content

Replace BotBuilder plugin with HTTP adapter#456

Merged
heyitsaamir merged 2 commits into
mainfrom
botbuilder-http-adapter
Jun 10, 2026
Merged

Replace BotBuilder plugin with HTTP adapter#456
heyitsaamir merged 2 commits into
mainfrom
botbuilder-http-adapter

Conversation

@heyitsaamir

@heyitsaamir heyitsaamir commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replace the BotBuilder plugin with an HTTP adapter so BotBuilder sits at the inbound HTTP boundary instead of plugin DI.

Why

This keeps the plugin surface less privileged and avoids passing app credentials/tokens/client internals into plugins just so BotBuilder can intercept requests.

Interesting bits

  • Adds BotBuilderAdapter and removes BotBuilderPlugin.
  • Updates the BotBuilder example to use adaptive cards where BotBuilder handles one Action.Execute and Teams SDK handles the other.
  • Cleans up no-longer-used plugin DI entries for raw credentials, bot token, app id, and raw client.

Migration

Before:

app = App(
    plugins=[BotBuilderPlugin(adapter=adapter, handler=EchoBot())]
)

After:

app = App(
    http_server_adapter=BotBuilderAdapter(
        cloud_adapter=adapter,
        handler=EchoBot(),
    )
)

If you do not already create a BotBuilder CloudAdapter, BotBuilderAdapter can create one from explicit credentials, MicrosoftApp* environment variables, or the same CLIENT_ID / CLIENT_SECRET / TENANT_ID vars used by teams.apps.

Reviewer tips

Start with packages/botbuilder/src/microsoft_teams/botbuilder/adapter.py, then peek at the example to see the migration shape.

Testing

  • uv run ruff check examples/botbuilder/src/bots/echo_bot.py packages/botbuilder/src/microsoft_teams/botbuilder/adapter.py examples/botbuilder/src/main.py packages/botbuilder/tests/test_botbuilder_adapter.py
  • uv run pyright packages/botbuilder/src/microsoft_teams/botbuilder/adapter.py examples/botbuilder/src/bots/echo_bot.py
  • uv run pytest packages/botbuilder/tests packages/apps/tests/test_card_action_routing.py
  • pre-commit on commit: ruff, ruff format, pyright, license header

Copilot AI review requested due to automatic review settings June 9, 2026 18:54

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 replaces the BotBuilder integration from a Teams “plugin” model to an HTTP server adapter model, so BotBuilder runs at the inbound HTTP boundary before Teams SDK routing/auth, reducing the need to inject privileged app internals into plugins.

Changes:

  • Adds BotBuilderAdapter and removes the prior BotBuilderPlugin implementation + its tests.
  • Updates the BotBuilder example to demonstrate split handling of Adaptive Card Action.Execute between BotBuilder and Teams SDK.
  • Removes now-unused plugin DI providers / dependency option types and updates example dependencies to include microsoft-teams-cards.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
uv.lock Adds workspace lock entry for microsoft-teams-cards used by the BotBuilder example.
packages/botbuilder/tests/test_botbuilder_plugin.py Removes tests for the deleted BotBuilderPlugin.
packages/botbuilder/tests/test_botbuilder_adapter.py Adds coverage for the new BotBuilderAdapter behavior (invoke handled vs fall-through).
packages/botbuilder/src/microsoft_teams/botbuilder/botbuilder_plugin.py Deletes the plugin-based integration implementation.
packages/botbuilder/src/microsoft_teams/botbuilder/adapter.py Introduces the HTTP adapter that runs BotBuilder before Teams SDK handlers.
packages/botbuilder/src/microsoft_teams/botbuilder/init.py Switches package exports from plugin symbols to adapter symbols.
packages/botbuilder/pyproject.toml Updates package description to reflect adapter-based integration.
packages/apps/src/microsoft_teams/apps/plugins/metadata.py Removes unused dependency option dataclasses from plugin metadata module.
packages/apps/src/microsoft_teams/apps/app.py Removes no-longer-used container providers for plugin DI.
examples/botbuilder/src/main.py Migrates example to use BotBuilderAdapter + adds adaptive card demo.
examples/botbuilder/src/bots/echo_bot.py Adds BotBuilder-side handling for one adaptive card invoke action.
examples/botbuilder/README.md Updates wording from “plugin” to “adapter”.
examples/botbuilder/pyproject.toml Adds microsoft-teams-cards dependency and workspace source.

Comment thread packages/botbuilder/src/microsoft_teams/botbuilder/adapter.py
Comment thread packages/botbuilder/src/microsoft_teams/botbuilder/adapter.py Outdated
Comment thread packages/botbuilder/src/microsoft_teams/botbuilder/__init__.py
@heyitsaamir heyitsaamir merged commit 5e00bc0 into main Jun 10, 2026
8 checks passed
@heyitsaamir heyitsaamir deleted the botbuilder-http-adapter branch June 10, 2026 00:59
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.

3 participants