Skip to main content

chat-adapter-teams

Microsoft Teams adapter for chat-py. Python port of upstream packages/adapter-teams.

Talks to the Bot Framework REST API directly via httpx + msal. Upstream uses @microsoft/teams.apps; no stable Python equivalent exists, so the adapter is implemented against the REST surface.

Install

uv add chat-py chat-py-adapter-teams chat-py-adapter-state-redis

Auth / config

TeamsAdapterConfig supports three auth modes:

Mode Fields Env var fallbacks
Client secret appId + appPassword TEAMS_APP_ID, TEAMS_APP_PASSWORD, TEAMS_APP_TENANT_ID
Federated identity federated (workload identity / managed ID) TEAMS_APP_ID, TEAMS_APP_TENANT_ID
Certificate (PEM) certificate — not implemented; raises ValidationError —

Additional config: appType ("MultiTenant" or "SingleTenant"), dialogOpenTimeoutMs, apiUrl.

Minimal example

from chat import Chat
from chat_adapter_teams import create_teams_adapter
from chat_adapter_state_redis import create_redis_state

bot = Chat(
    user_name="mybot",
    adapters={"teams": create_teams_adapter()},  # reads TEAMS_APP_ID etc.
    state=create_redis_state(url="redis://localhost:6379"),
)


@bot.on_new_message
async def reply(thread, message):
    await thread.post("Received.")

Mount bot.handle_webhook("teams", body, headers) under /api/webhooks/teams. The webhook handler verifies Bot Framework-signed JWTs via verify_bearer_token.

Thread ID

Teams thread IDs: teams:{base64(conversationId)}:{base64(serviceUrl)}.

Parity notes

  • JWT verification uses the same JWKS + issuer allowlist as upstream.
  • Adaptive Card translation (card_to_adaptive_card) targets the same schema as upstream's converter.
  • TeamsFormatConverter produces the same markdown↔mdast output.
  • Known gaps (v0.1.0 — raises NotImplementedError):
    • Microsoft Graph API conversation reader (read_thread)
    • Certificate-based auth (certificate config field)
  • Live event dispatch (@microsoft/teams.apps) is not ported; handle_webhook is a JWT-verifying shim. Full dispatch lands with the async Adapter protocol in core.

Test

uv run pytest packages/chat-adapter-teams

# Live — requires an app registration
TEAMS_APP_ID=... TEAMS_APP_PASSWORD=... uv run pytest packages/chat-integration-tests -k teams

Upstream

https://github.com/vercel/chat/tree/main/packages/adapter-teams

Metadata

Release files for chat-py-adapter-teams 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for chat-py-adapter-teams 0.1.0
File Interpreter ABI Platform Actions
chat_py_adapter_teams-0.1.0-py3-none-any.whl Python 3 none any Details for chat_py_adapter_teams-0.1.0-py3-none-any.whl

Release files / chat_py_adapter_teams-0.1.0-py3-none-any.whl

Download URL chat_py_adapter_teams-0.1.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f646a08609bf424f3d9adcb04ccd50a7328eda7ad3b94314f1cf6b75f311bc91
BLAKE2b-256 checksum
How to use checksums
328e21f4c5ce6487a069ccdcbb86e2db81dad3289c85bd91f4a3690b1078097e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.20 {"installer":{"name":"uv","version":"0.9.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for chat-py-adapter-teams 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page