Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microsoft_teams_apps-2.1.0a2.tar.gz (131.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microsoft_teams_apps-2.1.0a2-py3-none-any.whl (92.3 kB view details)

Uploaded Python 3

File details

Details for the file microsoft_teams_apps-2.1.0a2.tar.gz.

File metadata

  • Download URL: microsoft_teams_apps-2.1.0a2.tar.gz
  • Upload date:
  • Size: 131.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for microsoft_teams_apps-2.1.0a2.tar.gz
Algorithm Hash digest
SHA256 c118c9f1eb0224e2169fc6f5ef8f33bb1c86073c67e1e7f743f34d84077cbd0f
MD5 8a85b1842080d3c29dc0b5bc34c1ea0b
BLAKE2b-256 5c872387649ac64b8c7d73b14e41363d1288fbf0dccb43d0ea105238fedd3232

See more details on using hashes here.

File details

Details for the file microsoft_teams_apps-2.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for microsoft_teams_apps-2.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 6b3674887e6d6a0c9a72eae3815f965015eb8e4d6b7cb23955b01e155a5b9a6a
MD5 071b427fcc0fdc0c34b13d7f64de3d56
BLAKE2b-256 c6aa36c4f6d6b5a611886bd82eb3ea5c0c02316bb4947d4c9d23cee757e781a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page