| name | teams-cli |
| description | CLI skill for Microsoft Teams to read chats, send messages, search, manage reactions, files, channels, and presence from the terminal without API keys or admin consent |
| author | yusufaltunbicak |
| version | 0.4.0 |
| tags | ["teams","microsoft-teams","chat","messaging","office365","terminal","cli"] |
teams-cli Skill
Use this skill when the user wants to read, send, search, or manage Microsoft Teams chats and channels from the terminal. No Azure app registration, admin consent, or API keys required.
Prerequisites
cd ~/microsoft-teams-cli && pip install -e .
playwright install chromium
Authentication
- First run:
teams login opens Chromium, user logs in to Teams web, MSAL tokens are auto-extracted from localStorage.
- Extracts multiple tokens by audience: IC3 (chat service), Graph, Presence, Substrate (search).
- Region auto-detected from GTM localStorage key (emea/amer/apac).
- Tokens cached at
~/.cache/teams-cli/tokens.json (auto-expires based on JWT exp).
- Auto re-login on 401 via cached browser SSO state.
- Or set
TEAMS_IC3_TOKEN environment variable directly.
teams login
teams login --force
teams login --debug
teams whoami
Command Reference
Chats
teams chats
teams chats -n 50
teams chats --unread
teams chats --json
Unread
teams unread
teams unread -n 10
teams unread --json
Read Chat Messages
teams chat 3
teams chat 3 -n 50
teams chat 3 --json
Read Single Message
teams read 5
teams read 5 --raw
teams read 5 --json
Send Messages
teams send "John Doe" "Hello!"
teams send "john@company.com" "Hi there" -y
teams send "Jane" "<b>Bold</b> message" --html
teams chat-send 3 "Hello team!"
teams chat-send 3 "Meeting at 3pm" -y
Send Files
teams send-file 3 ./report.pdf
teams send-file 3 ./image.png -m "Here's the image"
teams send-file 3 ./doc.xlsx -y
Search
teams search "keyword"
teams search "budget report" -n 10
teams search "project" --chat 3
teams search "hello" --from "John"
teams search "meeting" --after 2026-03-01
teams search "review" --before 2026-02-28
teams search "quarterly" --json
Reactions
teams react 5 like
teams react 5 heart -y
teams unreact 5 like
teams unreact 5 laugh -y
Available reactions: like, heart, laugh, surprised, sad, angry.
Presence / Status
teams status
teams set-status Available
teams set-status Busy -y
teams set-status DoNotDisturb --expiry +1h
teams set-status Away --expiry +30m -y
Available statuses: Available, Busy, DoNotDisturb, BeRightBack, Away, Offline.
Scheduled Messages
teams schedule 3 "Reminder: standup" "+30m"
teams schedule 3 "Good morning!" "tomorrow 09:00" -y
teams schedule 3 "Done" "2026-03-15T10:00"
teams schedule-list
teams schedule-cancel 1
teams schedule-run
Time formats: +30m, +1h (relative), tomorrow 09:00 (day-relative), 2026-03-15T10:00 (absolute ISO).
Note: Teams has no native scheduled send. Messages are tracked locally and sent via schedule-run.
Attachments
teams attachments 5
teams attachments 5 -d
teams attachments 5 -d --save-to ~/Downloads
teams attachments 5 --json
Mark Read
teams mark-read 42 43 44
teams mark-read --chat 1 2 3 -y
teams mark-read 42 --unread
User Search
teams user-search "John"
teams user-search "john@company.com"
teams user-search "design team" --json
JSON / Scripting
Rich output goes to stderr, stdout is pure JSON for clean piping:
teams chats --json | jq '.[0].topic'
teams chat 3 --json | jq '.[].sender'
teams search "keyword" --json | jq 'length'
teams chats --json | jq '.[] | select(.unread_count > 0)'
teams unread --json | jq '.[].display_title'
teams user-search "John" --json | jq '.[0].email'
ID System
Chats get short display numbers (#1, #2, #3...) and messages get their own global sequence (#1, #2...). Numbers are assigned when listing and persist across commands. ID map is capped at 500 entries per section (LRU eviction).
teams chats
teams chat 3
teams chat 3 -n 20
teams read 15
teams react 15 like
teams reply 15 "Thanks"
Environment Variables
| Variable | Description |
|---|
TEAMS_IC3_TOKEN | Override IC3 token (skip login) |
TEAMS_REGION | Override region (default: auto-detected) |
TEAMS_PROXY | HTTP proxy URL |
TEAMS_CLI_CACHE | Cache directory (default: ~/.cache/teams-cli) |
TEAMS_CLI_CONFIG | Config directory (default: ~/.config/teams-cli) |
Common Patterns for AI Agents
teams unread
teams chat 3 -n 10
teams search "deployment failed" -n 5
teams search "status update" --from "Makbule"
teams send "john.doe@company.com" "Acknowledged, will review today." -y
teams chat-send 5 "Sounds good, let's proceed." -y
teams send-file 3 ./report.pdf -m "Weekly report attached" -y
teams status
teams set-status DoNotDisturb --expiry +1h -y
teams attachments 12 -d --save-to ~/Downloads
teams mark-read --chat 1 2 3 -y
teams schedule 3 "Don't forget: review PR" "+2h" -y
teams search "Yapay Zeka Kullanım Politikası" --json
Error Handling
- Token expired -> auto re-login attempted via cached browser SSO state.
Unknown chat #N -> run teams chats first to populate the ID map.
Unknown message #N -> run teams chat N first to see messages.
No results found -> try broader search terms or check spelling.
- HTTP 401 -> auto re-login. If it fails:
teams login --force.
- HTTP 429 -> automatic retry with backoff.
Safety Notes
- Tokens are cached with
chmod 600 (owner-only read/write).
- Browser state saved for SSO — avoids repeated logins.
send, chat-send, react, unreact, schedule, send-file, set-status ask for confirmation by default (use -y to skip).
- Anti-detection: random jitter between requests (0.3s reads, 2.0s writes), full browser headers.
- Do not share or log bearer tokens — they grant full Teams access.
- Prefer
teams login over manually copying tokens.