Skip to main content

Microsoft Teams Apps Framework

High-level framework for building Microsoft Teams applications. Handles activity routing, authentication, and provides Microsoft Graph integration.

Features

  • Activity Routing: Decorator-based routing for different activity types
  • OAuth Integration: Built-in OAuth flow handling for user authentication
  • Microsoft Graph Integration: Type-safe Graph client access via user_graph and app_graph properties
  • Plugin System: Extensible plugin architecture for adding functionality

Basic Usage

from microsoft_teams.apps import App, ActivityContext
from microsoft_teams.api import MessageActivity

app = App()

@app.on_message
async def handle_message(ctx: ActivityContext[MessageActivity]):
    await ctx.send(f"You said: {ctx.activity.text}")

# Start the app
await app.start()

Unauthenticated Requests

For local development only, JWT validation can be disabled explicitly:

app = App(dangerously_allow_unauthenticated_requests=True)

It can also be enabled with the DANGEROUSLY_ALLOW_UNAUTHENTICATED_REQUESTS=true environment variable. The previous skip_auth option is deprecated and remains supported for compatibility.

OAuth and Graph Integration

@app.on_message
async def handle_message(ctx: ActivityContext[MessageActivity]):
    if ctx.is_signed_in:
        try:
            # Access user's Graph data
            me = await ctx.user_graph.me.get()
            await ctx.send(f"Hello {me.display_name}!")
        except (ValueError, RuntimeError, ImportError) as e:
            await ctx.send(f"Graph access failed: {e}")
    else:
        # Prompt user to sign in
        await ctx.sign_in()

Optional Graph Dependencies

Microsoft Graph functionality requires additional dependencies:

pip install microsoft-teams-apps[graph]

Or if using uv:

uv add microsoft-teams-apps[graph]

If Graph dependencies are not installed, user_graph and app_graph will raise an ImportError when accessed. If the user is not signed in or tokens are unavailable, they will raise ValueError.

Metadata

Release files for microsoft-teams-apps 2.2.1

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

Source distribution (sdist)

Source distribution for microsoft-teams-apps 2.2.1
File Size Uploaded Provenance Actions
microsoft_teams_apps-2.2.1.tar.gz 325.4 kB Without provenance Details for microsoft_teams_apps-2.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for microsoft-teams-apps 2.2.1
File Interpreter ABI Platform Actions
microsoft_teams_apps-2.2.1-py3-none-any.whl Python 3 none any Details for microsoft_teams_apps-2.2.1-py3-none-any.whl

Total release size: 517.9 kB

Release files / microsoft_teams_apps-2.2.1.tar.gz

Download URL microsoft_teams_apps-2.2.1.tar.gz
Size 325.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7256467c1eba31398f0ba6e0d6e70d5a2fb8b64afca2a9decf7cde0d860e419b
BLAKE2b-256 checksum
How to use checksums
4730b4e0e11f28d2ad31588b519b8de89c96e8a2a8126fc2a777970deec66fb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / microsoft_teams_apps-2.2.1-py3-none-any.whl

Download URL microsoft_teams_apps-2.2.1-py3-none-any.whl
Size 192.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87d1ed8c198f709cc6782d2010293862e047c91a5875dfadf03ed0939284dbaa
BLAKE2b-256 checksum
How to use checksums
897e1d0caae50cd28dee1566f512e8ece06c0e9fb91396729119c3d4e752bb3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for microsoft-teams-apps 2.2.1

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

2.2.1 This release

2 release files 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