Anonymous View
Skip to main content

The app package for a Microsoft Teams agent

Project description

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()

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.

Project details


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.0.13.4.tar.gz (91.4 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.0.13.4-py3-none-any.whl (71.4 kB view details)

Uploaded Python 3

File details

Details for the file microsoft_teams_apps-2.0.13.4.tar.gz.

File metadata

File hashes

Hashes for microsoft_teams_apps-2.0.13.4.tar.gz
Algorithm Hash digest
SHA256 d0b12e5e82024cffd3739b329b098b98a08803753eb5484bf96dbb6ce1237e04
MD5 887246ce3aaa3c2b3ee083c8b494715a
BLAKE2b-256 610a733f05f8decee2da6e53ee38757e742520ae56363bc2d006b309cdbf9cfe

See more details on using hashes here.

File details

Details for the file microsoft_teams_apps-2.0.13.4-py3-none-any.whl.

File metadata

File hashes

Hashes for microsoft_teams_apps-2.0.13.4-py3-none-any.whl
Algorithm Hash digest
SHA256 db16f714ec658b592929c6386a29792e90bb73840732f8ae65a198cda1fea96c
MD5 9372e160d22ff1b4a7937e0598079955
BLAKE2b-256 3ad43c4205258642035d160c09f598a302260776dcb6d5bdf659eea7c6066d5e

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 Pingdom Monitoring Sentry Error logging StatusPage Status page