Connectors Teams
T

Teams

Chat

Overview

The Teams connector pulls messages from Microsoft Teams channels via the Microsoft Graph API and ingests them as claims using db.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}")

Setup

The Teams connector requires an Azure AD access token with the ChannelMessage.Read.All application permission. Follow these steps to configure access:

1 Register an Azure AD application

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.

2 Get an access token

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.

3 Find your team ID

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.

4 Install dependencies

pip install requests

The requests package is required for all HTTP-based connectors. For encrypted token storage, also install cryptography:

pip install requests cryptography

Parameters

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

Examples

Basic usage

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)

Filtered channels with saved token

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)

LLM extraction

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)

Related Connectors