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_graphandapp_graphproperties - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file microsoft_teams_apps-2.0.11.tar.gz.
File metadata
- Download URL: microsoft_teams_apps-2.0.11.tar.gz
- Upload date:
- Size: 87.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: RestSharp/106.13.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b90613572031ffb5d85e1ee7c0e2473cd653394d8dfd0937d180aca35e4db06
|
|
| MD5 |
749ba21a062fbd4f999cfa422f30c01e
|
|
| BLAKE2b-256 |
f469db054dc02dbf2eaf99e8b97fa34a8062142bfef857b7da5e8a791a20c423
|
File details
Details for the file microsoft_teams_apps-2.0.11-py3-none-any.whl.
File metadata
- Download URL: microsoft_teams_apps-2.0.11-py3-none-any.whl
- Upload date:
- Size: 70.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: RestSharp/106.13.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a36b0b8871c6ad30ea9d1db39c005fe325cc8d481319f3aed59decb80caa28b2
|
|
| MD5 |
85514ee936656c58e46fb38f20165176
|
|
| BLAKE2b-256 |
9d6c6d48b85f6f20fd63e05a6270539e71b0eafeed98eeba527021d2042b48fa
|