Skip to main content

The app package for a Microsoft Teams agent

Project description

[!CAUTION] This project is in active development and not ready for production use. It has not been publicly announced yet.

Microsoft Teams App 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:

# Recommended: Using uv
uv add microsoft-teams-apps[graph]

# Alternative: Using pip
pip install 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-0.0.1a4.tar.gz (52.9 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-0.0.1a4-py3-none-any.whl (58.0 kB view details)

Uploaded Python 3

File details

Details for the file microsoft_teams_apps-0.0.1a4.tar.gz.

File metadata

File hashes

Hashes for microsoft_teams_apps-0.0.1a4.tar.gz
Algorithm Hash digest
SHA256 da01e8beb20368ffba676cfe177eee3cd2871963a7460e01124cdc4fb17eb079
MD5 ea258864dd76a0516dad17af5887274d
BLAKE2b-256 4325e7f208668960fac34f367cd69bfeafb20cee40a531f5c1028643c25130ea

See more details on using hashes here.

File details

Details for the file microsoft_teams_apps-0.0.1a4-py3-none-any.whl.

File metadata

File hashes

Hashes for microsoft_teams_apps-0.0.1a4-py3-none-any.whl
Algorithm Hash digest
SHA256 81f4b349a8942061fad2eaefc58c2d80e238c738c6e6d16a85149a7c3214566c
MD5 c1d0fb1f8877b28cb96cd9bdd689cea8
BLAKE2b-256 7302963612db390e647ebba388f9a826f822bc186ff8a82f6b7ce8980a2fa80e

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