{"id":27957,"library":"microsoft-teams-api","title":"Microsoft Teams API","description":"Official Python SDK for building Microsoft Teams apps, bots, and message extensions. Current version 2.0.0 (stable), requiring Python 3.12+. The v2.0.0 release introduces a new namespace `microsoft_teams` (replacing `microsoft.teams`), proactive threading support, and sovereign cloud endpoints. Release cadence is irregular, with alpha releases leading to the stable v2.0.0.","status":"active","version":"2.0.0","language":"python","source_language":"en","source_url":"https://github.com/microsoft/teams.py/tree/main/packages/api/src/microsoft/teams/api","tags":["microsoft-teams","bot-framework","teams-sdk"],"install":[{"cmd":"pip install microsoft-teams-api","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Renamed in v2.0.0. Old namespace deprecated with warning in alpha, removed in stable.","wrong":"from microsoft.teams import TeamsApp","symbol":"TeamsApp","correct":"from microsoft_teams import TeamsApp"},{"note":"","wrong":"","symbol":"BotBuilderPlugin","correct":"from microsoft_teams.plugins import BotBuilderPlugin"}],"quickstart":{"code":"import os\nfrom microsoft_teams import TeamsApp\n\n# Initialize the app\napp = TeamsApp(\n    app_id=os.environ.get(\"TEAMS_APP_ID\", \"\"),\n    app_password=os.environ.get(\"TEAMS_APP_PASSWORD\", \"\"),\n)\n\n# Register a simple message handler\n@app.on_message\nasync def on_message(context, activity):\n    await context.reply(\"Hello from Teams SDK!\")\n\n# Start the bot\napp.run()","lang":"python","description":"Minimal Teams bot using the new microsoft_teams namespace."},"warnings":[{"fix":"Replace all imports from `microsoft.teams.*` with `microsoft_teams.*`.","message":"Namespace changed from `microsoft.teams` to `microsoft_teams` in v2.0.0. All import paths must be updated.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use HttpServer and HttpServerAdapter from microsoft_teams.server.","message":"HttpPlugin replaced by HttpServer and HttpServerAdapter. Existing HttpPlugin code will break.","severity":"breaking","affected_versions":">=2.0.0a20"},{"fix":"Ensure Python >=3.12 is used.","message":"Python requirement is 3.12+ (not 3.11 or lower). Installation will fail on older Python versions.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Replace custom logger calls with import logging.","message":"Custom logger removed; use standard logging library.","severity":"deprecated","affected_versions":">=2.0.0a20"},{"fix":"Initialize TeamsApp with `cloud='GCCH'` or `cloud='DoD'` for those environments.","message":"Sovereign cloud endpoints (GCCH, DoD, China) require explicit configuration. Default endpoint only works for global Azure.","severity":"gotcha","affected_versions":">=2.0.0a58"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Change imports to use `microsoft_teams` (e.g., `from microsoft_teams import TeamsApp`).","cause":"Imports use old namespace from v1.x or v2.0.0 alphas.","error":"ModuleNotFoundError: No module named 'microsoft.teams'"},{"fix":"Ensure all event handlers are declared with `async def` and use `await` when calling async methods.","cause":"Message handler not defined as async or event handlers not awaited.","error":"TypeError: 'coroutine' object is not callable"},{"fix":"Use `@app.on_message` decorator on an async function, not on the TeamsApp instance.","cause":"Decorator usage is wrong; on_message expects a function argument.","error":"AttributeError: 'TeamsApp' object has no attribute 'on_message'"},{"fix":"Set SERVICE_URL appropriate to your cloud (e.g., 'https://smba.infra.gccustom.microsoft.com' for GCCH).","cause":"Missing or incorrect SERVICE_URL environment variable for sovereign clouds.","error":"ValueError: Cannot connect to service URL: https://smba.trafficmanager.net/amer/"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}