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.0

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.0
File Size Uploaded Provenance Actions
microsoft_teams_apps-2.2.0.tar.gz 325.2 kB Without provenance Details for microsoft_teams_apps-2.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 518.0 kB

Release files / microsoft_teams_apps-2.2.0.tar.gz

Download URL microsoft_teams_apps-2.2.0.tar.gz
Size 325.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4a8cf9d879cf0a6fa87d3d018f4cac1108e90a7800b2f81ac949131d6386273d
BLAKE2b-256 checksum
How to use checksums
cc1f415a7c84aed0dbe0a0c43b2eff4de5911b7a0dd238a4b045cf861b45c520
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.0-py3-none-any.whl

Download URL microsoft_teams_apps-2.2.0-py3-none-any.whl
Size 192.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c9924e692caacfdb1d577f83a08a135b72b106c1b5e53d1893eb6f6d4ee86c0
BLAKE2b-256 checksum
How to use checksums
6741b0faa1f30b2416ae52ece00fa471f08264d6a7684345074d371880831c31
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.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

2.2.0 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