MS365 Notifier is a powerful Python library for sending notifications across Microsoft 365 services including Teams, Outlook, and SharePoint. Built on top of Microsoft Graph API, it provides a simple and intuitive interface for integrating notifications into your Python applications.
đ Easy to Use
Simple API with sensible defaults. Get started with just a few lines of code.
đ Secure Authentication
Support for multiple authentication methods including OAuth2 and service principals.
đ¨ Multi-Channel
Send notifications to Teams channels, Outlook emails, and SharePoint sites.
⥠Async Support
Full async/await support for high-performance applications.
Installation
Install MS365 Notifier using pip:
pip install ms365-notifier
Or with optional dependencies for enhanced features:
pip install ms365-notifier[templates,async]
Quick Start
Here's a simple example to send a notification to a Teams channel:
from ms365_notifier import Notifier
# Initialize the notifier with your credentials
notifier = Notifier(
client_id="your-client-id",
client_secret="your-client-secret",
tenant_id="your-tenant-id"
)
# Send a simple message to Teams
notifier.teams.send_message(
channel_id="your-channel-id",
message="Hello from MS365 Notifier! đ"
)
Authentication
MS365 Notifier supports multiple authentication methods to fit your use case:
OAuth2 Authentication
Use OAuth2 for interactive applications where users log in with their Microsoft accounts:
from ms365_notifier import Notifier, OAuth2Config
config = OAuth2Config(
client_id="your-client-id",
redirect_uri="http://localhost:8000/callback",
scopes=["ChannelMessage.Send", "Mail.Send"]
)
notifier = Notifier(auth_config=config)
auth_url = notifier.get_auth_url()
print(f"Please visit: {auth_url}")
# After user authorizes, exchange code for token
notifier.authenticate(authorization_code="received-code")
Service Principal Authentication
Ideal for backend services and automation:
from ms365_notifier import Notifier
notifier = Notifier(
client_id="your-client-id",
client_secret="your-client-secret",
tenant_id="your-tenant-id"
)
# No user interaction needed
notifier.authenticate()
Delegated Authentication
Use an existing access token from another service:
from ms365_notifier import Notifier
notifier = Notifier(access_token="existing-access-token")
# Ready to use immediately
notifier.teams.send_message(...)
Security Note: Never commit credentials to version control. Use environment variables or secure credential storage solutions.
Teams Notifications
Send rich, formatted messages to Microsoft Teams channels and users: