The Teams connector pulls messages from Microsoft Teams channels via the
Microsoft Graph API
and ingests them as claims using db.ingest_chat().
messageType == "message" is processeddb.ingest_chat()# Quick start conn = db.connect("teams", token=os.environ["TEAMS_ACCESS_TOKEN"], team_id="...") result = conn.run(db) print(f"Ingested {result.claims_ingested} claims from {result.source}")
The Teams connector requires an Azure AD access token with the
ChannelMessage.Read.All application permission. Follow these steps to configure access:
Go to the
Azure Portal > App registrations
and create a new application. Under API permissions, add the Microsoft Graph application permission
ChannelMessage.Read.All and grant admin consent.
Use the Microsoft identity platform OAuth 2.0 client credentials flow to obtain an access token.
The token must be issued for the https://graph.microsoft.com/.default scope.
You can find the team ID from the Teams admin center, or by calling the Graph API endpoint
GET /me/joinedTeams. The id field in the response is the value you need.
pip install requests
The requests package is required for all HTTP-based connectors.
For encrypted token storage, also install cryptography:
pip install requests cryptography
All parameters are passed to db.connect("teams", ...).
| Parameter | Required | Default | Description |
|---|---|---|---|
token |
Yes | — | Azure AD access token with ChannelMessage.Read.All permission |
team_id |
Yes | — | Microsoft Teams team ID |
channels |
No | All | List of channel names to fetch (omit to fetch all channels) |
extraction |
No | heuristic |
Extraction mode: heuristic, smart, or llm |
save |
No | False |
Encrypt and persist the token for future connections |
Connect to a team and ingest all channel messages with default heuristic extraction.
conn = db.connect("teams", token=os.environ["TEAMS_ACCESS_TOKEN"], team_id="...", ) result = conn.run(db)
Fetch only specific channels and persist the token for future sessions.
conn = db.connect("teams", token=os.environ["TEAMS_ACCESS_TOKEN"], team_id="abc-123-def", channels=["general", "engineering"], save=True, ) result = conn.run(db)
Use LLM-powered extraction for higher-quality claim parsing from message content.
conn = db.connect("teams", token=os.environ["TEAMS_ACCESS_TOKEN"], team_id="abc-123-def", extraction="llm", ) result = conn.run(db)