microsoft-teams-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microsoft_teams_cli-0.1.0/.agents/skills/teams-cli/SKILL.md +302 -0
- microsoft_teams_cli-0.1.0/.claude/skills/teams-cli/SKILL.md +277 -0
- microsoft_teams_cli-0.1.0/.gitignore +48 -0
- microsoft_teams_cli-0.1.0/AGENTS.md +99 -0
- microsoft_teams_cli-0.1.0/CLAUDE.md +99 -0
- microsoft_teams_cli-0.1.0/CODE_OF_CONDUCT.md +29 -0
- microsoft_teams_cli-0.1.0/CONTRIBUTING.md +44 -0
- microsoft_teams_cli-0.1.0/LICENSE +21 -0
- microsoft_teams_cli-0.1.0/PKG-INFO +256 -0
- microsoft_teams_cli-0.1.0/README.md +221 -0
- microsoft_teams_cli-0.1.0/TESTING.md +51 -0
- microsoft_teams_cli-0.1.0/config.example.yaml +22 -0
- microsoft_teams_cli-0.1.0/pyproject.toml +65 -0
- microsoft_teams_cli-0.1.0/teams_cli/__init__.py +1 -0
- microsoft_teams_cli-0.1.0/teams_cli/anti_detection.py +83 -0
- microsoft_teams_cli-0.1.0/teams_cli/auth.py +325 -0
- microsoft_teams_cli-0.1.0/teams_cli/cli.py +25 -0
- microsoft_teams_cli-0.1.0/teams_cli/client.py +1652 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/__init__.py +28 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/_common.py +114 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/attachments.py +62 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/auth.py +51 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/chat.py +107 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/group_chat.py +83 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/mark_read.py +42 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/message_manage.py +45 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/presence.py +81 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/reactions.py +65 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/schedule.py +158 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/search.py +61 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/send.py +126 -0
- microsoft_teams_cli-0.1.0/teams_cli/commands/teams_channels.py +55 -0
- microsoft_teams_cli-0.1.0/teams_cli/config.py +42 -0
- microsoft_teams_cli-0.1.0/teams_cli/constants.py +44 -0
- microsoft_teams_cli-0.1.0/teams_cli/exceptions.py +47 -0
- microsoft_teams_cli-0.1.0/teams_cli/formatter.py +236 -0
- microsoft_teams_cli-0.1.0/teams_cli/models.py +390 -0
- microsoft_teams_cli-0.1.0/teams_cli/scheduler.py +82 -0
- microsoft_teams_cli-0.1.0/teams_cli/serialization.py +58 -0
- microsoft_teams_cli-0.1.0/tests/__init__.py +0 -0
- microsoft_teams_cli-0.1.0/tests/conftest.py +304 -0
- microsoft_teams_cli-0.1.0/tests/test_auth.py +174 -0
- microsoft_teams_cli-0.1.0/tests/test_cli_chat.py +162 -0
- microsoft_teams_cli-0.1.0/tests/test_cli_group_chat.py +137 -0
- microsoft_teams_cli-0.1.0/tests/test_cli_message_manage.py +110 -0
- microsoft_teams_cli-0.1.0/tests/test_cli_reactions_multi.py +196 -0
- microsoft_teams_cli-0.1.0/tests/test_cli_schedule.py +151 -0
- microsoft_teams_cli-0.1.0/tests/test_cli_search.py +157 -0
- microsoft_teams_cli-0.1.0/tests/test_cli_send.py +184 -0
- microsoft_teams_cli-0.1.0/tests/test_cli_teams.py +38 -0
- microsoft_teams_cli-0.1.0/tests/test_client_id_map.py +122 -0
- microsoft_teams_cli-0.1.0/tests/test_client_search_and_attachments.py +278 -0
- microsoft_teams_cli-0.1.0/tests/test_client_send_payload.py +205 -0
- microsoft_teams_cli-0.1.0/tests/test_formatter.py +82 -0
- microsoft_teams_cli-0.1.0/tests/test_live_smoke.py +256 -0
- microsoft_teams_cli-0.1.0/tests/test_scheduler.py +103 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: teams-cli
|
|
3
|
+
description: CLI skill for Microsoft Teams to read chats, send/edit/delete/forward messages, create group chats, search, manage reactions, files, and presence from the terminal without API keys or admin consent
|
|
4
|
+
author: yusufaltunbicak
|
|
5
|
+
version: "0.5.0"
|
|
6
|
+
tags:
|
|
7
|
+
- teams
|
|
8
|
+
- microsoft-teams
|
|
9
|
+
- chat
|
|
10
|
+
- messaging
|
|
11
|
+
- office365
|
|
12
|
+
- terminal
|
|
13
|
+
- cli
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# teams-cli Skill
|
|
17
|
+
|
|
18
|
+
Use this skill when the user wants to read, send, search, or manage Microsoft Teams chats from the terminal. No Azure app registration, admin consent, or API keys required.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Install (requires Python 3.10+)
|
|
24
|
+
cd ~/microsoft-teams-cli && pip install -e .
|
|
25
|
+
playwright install chromium
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Authentication
|
|
29
|
+
|
|
30
|
+
- First run: `teams login` opens Chromium, user logs in to Teams web, MSAL tokens are auto-extracted from localStorage.
|
|
31
|
+
- Extracts multiple tokens by audience: IC3 (chat service), Graph, Presence, Substrate (search).
|
|
32
|
+
- Region auto-detected from GTM localStorage key (emea/amer/apac).
|
|
33
|
+
- Tokens cached at `~/.cache/teams-cli/tokens.json` (auto-expires based on JWT exp).
|
|
34
|
+
- Auto re-login on 401 via cached browser SSO state.
|
|
35
|
+
- Or set `TEAMS_IC3_TOKEN` environment variable directly.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
teams login # Interactive browser login
|
|
39
|
+
teams login --force # Force re-login, ignore saved session
|
|
40
|
+
teams login --debug # Show debug info about token extraction
|
|
41
|
+
teams whoami # Verify current user
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Command Reference
|
|
45
|
+
|
|
46
|
+
### Chats
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
teams chats # List recent chats
|
|
50
|
+
teams chats -n 50 # Limit count
|
|
51
|
+
teams chats --offset 10 # Skip first 10
|
|
52
|
+
teams chats --unread # Unread only
|
|
53
|
+
teams chats --json # JSON output
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Unread
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
teams unread # Show chats with unread messages
|
|
60
|
+
teams unread -n 10 # Limit count
|
|
61
|
+
teams unread --json # JSON output
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Read Chat Messages
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
teams chat 3 # Read messages from chat #3
|
|
68
|
+
teams chat 3 -n 50 # Limit message count
|
|
69
|
+
teams chat 3 --offset 25 # Skip first 25 messages
|
|
70
|
+
teams chat 3 --json # JSON output
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Read Single Message
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
teams read 5 # Read full message detail by number
|
|
77
|
+
teams read 5 --raw # Show raw HTML content
|
|
78
|
+
teams read 5 --json # JSON output
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Send Messages
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
teams send "John Doe" "Hello!" # Send to person (resolves name/email)
|
|
85
|
+
teams send "john@company.com" "Hi there" -y # Skip confirmation
|
|
86
|
+
teams send "Jane" "<b>Bold</b> message" --html # Send as HTML
|
|
87
|
+
|
|
88
|
+
teams chat-send 3 "Hello team!" # Send to existing chat #3
|
|
89
|
+
teams chat-send 3 "Meeting at 3pm" -y # Skip confirmation
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Reply
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
teams reply 42 "On it." -y # Reply to message #42
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Edit & Delete
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
teams edit 42 "Updated text" -y # Edit a sent message
|
|
102
|
+
teams delete 42 -y # Delete a message
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Forward
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
teams forward 42 3 -y # Forward message #42 to chat #3
|
|
109
|
+
teams forward 42 3 --comment "FYI" -y # Forward with comment
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Group Chat
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
teams group-chat "Alice" "Bob" --topic "Project X" --message "Kickoff!" -y
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Send Files
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
teams send-file 3 ./report.pdf # Upload to OneDrive + send in chat
|
|
122
|
+
teams send-file 3 ./image.png -m "Here's the image" # With message
|
|
123
|
+
teams send-file 3 ./doc.xlsx -y # Skip confirmation
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Search
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
teams search "keyword" # Search across all chats
|
|
130
|
+
teams search "budget report" -n 10 # Limit results
|
|
131
|
+
teams search "project" --chat 3 # Search within chat #3
|
|
132
|
+
teams search "hello" --from "John" # Filter by sender
|
|
133
|
+
teams search "meeting" --after 2026-03-01 # After date
|
|
134
|
+
teams search "review" --before 2026-02-28 # Before date
|
|
135
|
+
teams search "quarterly" --offset 10 --json # Paginate + JSON
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Reactions (multi-ID)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
teams react like 5 6 7 -y # React to multiple messages
|
|
142
|
+
teams unreact like 5 6 7 -y # Remove reactions
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Available reactions: `like`, `heart`, `laugh`, `surprised`, `sad`, `angry`.
|
|
146
|
+
|
|
147
|
+
### Mark Read / Unread
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
teams mark-read 5 6 7 -y # Mark messages as read
|
|
151
|
+
teams mark-read 5 --unread -y # Mark as unread
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Presence / Status
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
teams status # Show current presence
|
|
158
|
+
teams set-status Available # Set status
|
|
159
|
+
teams set-status Busy -y # Skip confirmation
|
|
160
|
+
teams set-status DoNotDisturb --expiry +1h # With expiry
|
|
161
|
+
teams set-status Offline -y # Appear offline
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Available statuses: `Available`, `Busy`, `DoNotDisturb`, `BeRightBack`, `Away`, `Offline`.
|
|
165
|
+
|
|
166
|
+
### Scheduled Messages
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
teams schedule 3 "Reminder: standup" "+30m" # Schedule in chat #3
|
|
170
|
+
teams schedule 3 "Good morning!" "tomorrow 09:00" -y # Skip confirmation
|
|
171
|
+
teams schedule 3 "Done" "2026-03-15T10:00" # Exact datetime
|
|
172
|
+
|
|
173
|
+
teams schedule-list # List scheduled messages
|
|
174
|
+
teams schedule-cancel 1 # Cancel by list number
|
|
175
|
+
teams schedule-run # Send all due messages
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Time formats:** `+30m`, `+1h` (relative), `tomorrow 09:00` (day-relative), `2026-03-15T10:00` (absolute ISO).
|
|
179
|
+
|
|
180
|
+
**Note:** Teams has no native scheduled send. Messages are tracked locally and sent via `schedule-run`.
|
|
181
|
+
|
|
182
|
+
### Attachments
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
teams attachments 5 # List attachments on message #5
|
|
186
|
+
teams attachments 5 -d # Download all
|
|
187
|
+
teams attachments 5 -d --save-to ~/Downloads # Custom download path
|
|
188
|
+
teams attachments 5 --json # JSON output
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Teams & Channels
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
teams teams # List joined teams
|
|
195
|
+
teams teams --offset 5 --json # Paginate + JSON
|
|
196
|
+
|
|
197
|
+
teams channels 1 # List channels in team #1
|
|
198
|
+
teams channels 1 --offset 3 --json # Paginate + JSON
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### User Search
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
teams user-search "John" # Search by name
|
|
205
|
+
teams user-search "john@company.com" # Search by email
|
|
206
|
+
teams user-search "design team" --json # JSON output
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## JSON / Scripting
|
|
210
|
+
|
|
211
|
+
All JSON output uses envelope format: `{ok: true, schema_version: "1.0", data: [...]}`.
|
|
212
|
+
When stdout is piped, JSON is output automatically (no `--json` flag needed):
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
teams chats | jq '.data[0].topic'
|
|
216
|
+
teams chat 3 | jq '.data[].sender'
|
|
217
|
+
teams search "keyword" | jq '.data | length'
|
|
218
|
+
teams chats | jq '.data[] | select(.unread_count > 0)'
|
|
219
|
+
teams user-search "John" | jq '.data[0].email'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## ID System
|
|
223
|
+
|
|
224
|
+
Chats get short display numbers (#1, #2, #3...) and messages get their own global sequence (#1, #2...). Teams use `#1`, `#2` format. Numbers are assigned when listing and persist across commands. ID map is capped at 500 entries per section (LRU eviction).
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
teams chats # Shows #1, #2, #3...
|
|
228
|
+
teams chat 3 # Read messages from chat #3
|
|
229
|
+
teams chat 3 -n 20 # Messages get #N numbers
|
|
230
|
+
teams read 15 # Read message #15 in detail
|
|
231
|
+
teams react like 15 # React to message #15
|
|
232
|
+
teams reply 15 "Thanks" # Reply to message #15
|
|
233
|
+
teams edit 15 "Updated" # Edit message #15
|
|
234
|
+
teams delete 15 # Delete message #15
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Environment Variables
|
|
238
|
+
|
|
239
|
+
| Variable | Description |
|
|
240
|
+
|----------|-------------|
|
|
241
|
+
| `TEAMS_IC3_TOKEN` | Override IC3 token (skip login) |
|
|
242
|
+
| `TEAMS_REGION` | Override region (default: auto-detected) |
|
|
243
|
+
| `TEAMS_PROXY` | HTTP proxy URL |
|
|
244
|
+
| `TEAMS_TIMEOUT` | HTTP request timeout in seconds (default: 30) |
|
|
245
|
+
| `TEAMS_CLI_CACHE` | Cache directory (default: `~/.cache/teams-cli`) |
|
|
246
|
+
| `TEAMS_CLI_CONFIG` | Config directory (default: `~/.config/teams-cli`) |
|
|
247
|
+
|
|
248
|
+
## Common Patterns for AI Agents
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Quick check for new messages
|
|
252
|
+
teams unread
|
|
253
|
+
|
|
254
|
+
# Read latest messages from a specific chat
|
|
255
|
+
teams chat 3 -n 10
|
|
256
|
+
|
|
257
|
+
# Find a specific message across all chats
|
|
258
|
+
teams search "deployment failed" -n 5
|
|
259
|
+
|
|
260
|
+
# Send a quick message to someone
|
|
261
|
+
teams send "john.doe@company.com" "Acknowledged, will review today." -y
|
|
262
|
+
|
|
263
|
+
# Create a group chat for a project
|
|
264
|
+
teams group-chat "Alice" "Bob" --topic "Sprint 42" --message "Kickoff" -y
|
|
265
|
+
|
|
266
|
+
# Edit a typo in a sent message
|
|
267
|
+
teams edit 42 "Corrected text here" -y
|
|
268
|
+
|
|
269
|
+
# Forward important info to another chat
|
|
270
|
+
teams forward 42 3 --comment "Please review" -y
|
|
271
|
+
|
|
272
|
+
# Share a file in a chat
|
|
273
|
+
teams send-file 3 ./report.pdf -m "Weekly report attached" -y
|
|
274
|
+
|
|
275
|
+
# Set DND for a meeting
|
|
276
|
+
teams set-status DoNotDisturb --expiry +1h -y
|
|
277
|
+
|
|
278
|
+
# Download attachments from a message
|
|
279
|
+
teams attachments 12 -d --save-to ~/Downloads
|
|
280
|
+
|
|
281
|
+
# Schedule a reminder
|
|
282
|
+
teams schedule 3 "Don't forget: review PR" "+2h" -y
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Error Handling
|
|
286
|
+
|
|
287
|
+
- Token expired -> auto re-login attempted via cached browser SSO state.
|
|
288
|
+
- `Unknown chat #N` -> run `teams chats` first to populate the ID map.
|
|
289
|
+
- `Unknown message #N` -> run `teams chat N` first to see messages.
|
|
290
|
+
- `No results found` -> try broader search terms or check spelling.
|
|
291
|
+
- HTTP 401 -> auto re-login. If it fails: `teams login --force`.
|
|
292
|
+
- HTTP 429 -> automatic retry with backoff.
|
|
293
|
+
|
|
294
|
+
## Safety Notes
|
|
295
|
+
|
|
296
|
+
- Tokens are cached with `chmod 600` (owner-only read/write).
|
|
297
|
+
- Browser state saved for SSO — avoids repeated logins.
|
|
298
|
+
- Write commands ask for confirmation by default (use `-y` to skip).
|
|
299
|
+
- `send` refuses `-y` when name match is uncertain — prevents wrong-person sends.
|
|
300
|
+
- Self-messages route to `48:notes` (not to random 1:1 chats).
|
|
301
|
+
- Anti-detection: random jitter between requests (0.3s reads, 2.0s writes), full browser headers.
|
|
302
|
+
- Do not share or log bearer tokens — they grant full Teams access.
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: teams-cli
|
|
3
|
+
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
|
|
4
|
+
author: yusufaltunbicak
|
|
5
|
+
version: "0.4.0"
|
|
6
|
+
tags:
|
|
7
|
+
- teams
|
|
8
|
+
- microsoft-teams
|
|
9
|
+
- chat
|
|
10
|
+
- messaging
|
|
11
|
+
- office365
|
|
12
|
+
- terminal
|
|
13
|
+
- cli
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# teams-cli Skill
|
|
17
|
+
|
|
18
|
+
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.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Install (requires Python 3.10+)
|
|
24
|
+
cd ~/microsoft-teams-cli && pip install -e .
|
|
25
|
+
playwright install chromium
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Authentication
|
|
29
|
+
|
|
30
|
+
- First run: `teams login` opens Chromium, user logs in to Teams web, MSAL tokens are auto-extracted from localStorage.
|
|
31
|
+
- Extracts multiple tokens by audience: IC3 (chat service), Graph, Presence, Substrate (search).
|
|
32
|
+
- Region auto-detected from GTM localStorage key (emea/amer/apac).
|
|
33
|
+
- Tokens cached at `~/.cache/teams-cli/tokens.json` (auto-expires based on JWT exp).
|
|
34
|
+
- Auto re-login on 401 via cached browser SSO state.
|
|
35
|
+
- Or set `TEAMS_IC3_TOKEN` environment variable directly.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
teams login # Interactive browser login
|
|
39
|
+
teams login --force # Force re-login, ignore saved session
|
|
40
|
+
teams login --debug # Show debug info about token extraction
|
|
41
|
+
teams whoami # Verify current user
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Command Reference
|
|
45
|
+
|
|
46
|
+
### Chats
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
teams chats # List recent chats
|
|
50
|
+
teams chats -n 50 # Limit count
|
|
51
|
+
teams chats --unread # Unread only
|
|
52
|
+
teams chats --json # JSON output
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Unread
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
teams unread # Show chats with unread messages
|
|
59
|
+
teams unread -n 10 # Limit count
|
|
60
|
+
teams unread --json # JSON output
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Read Chat Messages
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
teams chat 3 # Read messages from chat #3
|
|
67
|
+
teams chat 3 -n 50 # Limit message count
|
|
68
|
+
teams chat 3 --json # JSON output
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Read Single Message
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
teams read 5 # Read full message detail by number
|
|
75
|
+
teams read 5 --raw # Show raw HTML content
|
|
76
|
+
teams read 5 --json # JSON output
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Send Messages
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
teams send "John Doe" "Hello!" # Send to person (resolves name/email)
|
|
83
|
+
teams send "john@company.com" "Hi there" -y # Skip confirmation
|
|
84
|
+
teams send "Jane" "<b>Bold</b> message" --html # Send as HTML
|
|
85
|
+
|
|
86
|
+
teams chat-send 3 "Hello team!" # Send to existing chat #3
|
|
87
|
+
teams chat-send 3 "Meeting at 3pm" -y # Skip confirmation
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Send Files
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
teams send-file 3 ./report.pdf # Upload to OneDrive + send in chat
|
|
94
|
+
teams send-file 3 ./image.png -m "Here's the image" # With message
|
|
95
|
+
teams send-file 3 ./doc.xlsx -y # Skip confirmation
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Search
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
teams search "keyword" # Search across all chats
|
|
102
|
+
teams search "budget report" -n 10 # Limit results
|
|
103
|
+
teams search "project" --chat 3 # Search within chat #3
|
|
104
|
+
teams search "hello" --from "John" # Filter by sender
|
|
105
|
+
teams search "meeting" --after 2026-03-01 # After date
|
|
106
|
+
teams search "review" --before 2026-02-28 # Before date
|
|
107
|
+
teams search "quarterly" --json # JSON output
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Reactions
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
teams react 5 like # Add reaction (shows confirmation)
|
|
114
|
+
teams react 5 heart -y # Skip confirmation
|
|
115
|
+
teams unreact 5 like # Remove reaction
|
|
116
|
+
teams unreact 5 laugh -y # Skip confirmation
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Available reactions: `like`, `heart`, `laugh`, `surprised`, `sad`, `angry`.
|
|
120
|
+
|
|
121
|
+
### Presence / Status
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
teams status # Show current presence
|
|
125
|
+
teams set-status Available # Set status
|
|
126
|
+
teams set-status Busy -y # Skip confirmation
|
|
127
|
+
teams set-status DoNotDisturb --expiry +1h # With expiry
|
|
128
|
+
teams set-status Away --expiry +30m -y # Expiry + skip confirm
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Available statuses: `Available`, `Busy`, `DoNotDisturb`, `BeRightBack`, `Away`, `Offline`.
|
|
132
|
+
|
|
133
|
+
### Scheduled Messages
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
teams schedule 3 "Reminder: standup" "+30m" # Schedule in chat #3
|
|
137
|
+
teams schedule 3 "Good morning!" "tomorrow 09:00" -y # Skip confirmation
|
|
138
|
+
teams schedule 3 "Done" "2026-03-15T10:00" # Exact datetime
|
|
139
|
+
|
|
140
|
+
teams schedule-list # List scheduled messages
|
|
141
|
+
teams schedule-cancel 1 # Cancel by list number
|
|
142
|
+
teams schedule-run # Send all due messages
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Time formats:** `+30m`, `+1h` (relative), `tomorrow 09:00` (day-relative), `2026-03-15T10:00` (absolute ISO).
|
|
146
|
+
|
|
147
|
+
**Note:** Teams has no native scheduled send. Messages are tracked locally and sent via `schedule-run`.
|
|
148
|
+
|
|
149
|
+
### Attachments
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
teams attachments 5 # List attachments on message #5
|
|
153
|
+
teams attachments 5 -d # Download all
|
|
154
|
+
teams attachments 5 -d --save-to ~/Downloads # Custom download path
|
|
155
|
+
teams attachments 5 --json # JSON output
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Teams & Channels
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
teams teams # List joined teams
|
|
162
|
+
teams teams --json # JSON output
|
|
163
|
+
|
|
164
|
+
teams channels team_1 # List channels in team
|
|
165
|
+
teams channels team_1 --json # JSON output
|
|
166
|
+
|
|
167
|
+
teams channel team_1 channel_1_1 # Read channel messages
|
|
168
|
+
teams channel team_1 channel_1_1 -n 50 # Limit count
|
|
169
|
+
teams channel team_1 channel_1_1 --json # JSON output
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### User Search
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
teams user-search "John" # Search by name
|
|
176
|
+
teams user-search "john@company.com" # Search by email
|
|
177
|
+
teams user-search "design team" --json # JSON output
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## JSON / Scripting
|
|
181
|
+
|
|
182
|
+
Rich output goes to stderr, stdout is pure JSON for clean piping:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
teams chats --json | jq '.[0].topic'
|
|
186
|
+
teams chat 3 --json | jq '.[].sender'
|
|
187
|
+
teams search "keyword" --json | jq 'length'
|
|
188
|
+
teams chats --json | jq '.[] | select(.unread_count > 0)'
|
|
189
|
+
teams unread --json | jq '.[].display_title'
|
|
190
|
+
teams user-search "John" --json | jq '.[0].email'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## ID System
|
|
194
|
+
|
|
195
|
+
Chats get short display numbers (#1, #2, #3...) and messages get their own global sequence (#1, #2...). Teams use `team_1`, `team_2` format; channels use `channel_1_1`, `channel_1_2` format. Numbers are assigned when listing and persist across commands. ID map is capped at 500 entries per section (LRU eviction).
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
teams chats # Shows #1, #2, #3...
|
|
199
|
+
teams chat 3 # Read messages from chat #3
|
|
200
|
+
teams chat 3 -n 20 # Messages get #N numbers
|
|
201
|
+
teams read 15 # Read message #15 in detail
|
|
202
|
+
teams react 15 like # React to message #15
|
|
203
|
+
teams reply 15 "Thanks" # (if available)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Environment Variables
|
|
207
|
+
|
|
208
|
+
| Variable | Description |
|
|
209
|
+
|----------|-------------|
|
|
210
|
+
| `TEAMS_IC3_TOKEN` | Override IC3 token (skip login) |
|
|
211
|
+
| `TEAMS_REGION` | Override region (default: auto-detected) |
|
|
212
|
+
| `TEAMS_PROXY` | HTTP proxy URL |
|
|
213
|
+
| `TEAMS_CLI_CACHE` | Cache directory (default: `~/.cache/teams-cli`) |
|
|
214
|
+
| `TEAMS_CLI_CONFIG` | Config directory (default: `~/.config/teams-cli`) |
|
|
215
|
+
|
|
216
|
+
## Common Patterns for AI Agents
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Quick check for new messages
|
|
220
|
+
teams unread
|
|
221
|
+
|
|
222
|
+
# Read latest messages from a specific chat
|
|
223
|
+
teams chat 3 -n 10
|
|
224
|
+
|
|
225
|
+
# Find a specific message across all chats
|
|
226
|
+
teams search "deployment failed" -n 5
|
|
227
|
+
|
|
228
|
+
# Find messages from a person
|
|
229
|
+
teams search "status update" --from "Makbule"
|
|
230
|
+
|
|
231
|
+
# Send a quick message to someone
|
|
232
|
+
teams send "john.doe@company.com" "Acknowledged, will review today." -y
|
|
233
|
+
|
|
234
|
+
# Reply in a group chat
|
|
235
|
+
teams chat-send 5 "Sounds good, let's proceed." -y
|
|
236
|
+
|
|
237
|
+
# Share a file in a chat
|
|
238
|
+
teams send-file 3 ./report.pdf -m "Weekly report attached" -y
|
|
239
|
+
|
|
240
|
+
# Check someone's presence before messaging
|
|
241
|
+
teams status
|
|
242
|
+
|
|
243
|
+
# Set DND for a meeting
|
|
244
|
+
teams set-status DoNotDisturb --expiry +1h -y
|
|
245
|
+
|
|
246
|
+
# Download attachments from a message
|
|
247
|
+
teams attachments 12 -d --save-to ~/Downloads
|
|
248
|
+
|
|
249
|
+
# Browse team channels
|
|
250
|
+
teams teams
|
|
251
|
+
teams channels team_1
|
|
252
|
+
teams channel team_1 channel_1_1 -n 20
|
|
253
|
+
|
|
254
|
+
# Schedule a reminder
|
|
255
|
+
teams schedule 3 "Don't forget: review PR" "+2h" -y
|
|
256
|
+
|
|
257
|
+
# Search for a document shared in chats
|
|
258
|
+
teams search "Yapay Zeka Kullanım Politikası" --json
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Error Handling
|
|
262
|
+
|
|
263
|
+
- Token expired -> auto re-login attempted via cached browser SSO state.
|
|
264
|
+
- `Unknown chat #N` -> run `teams chats` first to populate the ID map.
|
|
265
|
+
- `Unknown message #N` -> run `teams chat N` first to see messages.
|
|
266
|
+
- `No results found` -> try broader search terms or check spelling.
|
|
267
|
+
- HTTP 401 -> auto re-login. If it fails: `teams login --force`.
|
|
268
|
+
- HTTP 429 -> automatic retry with backoff.
|
|
269
|
+
|
|
270
|
+
## Safety Notes
|
|
271
|
+
|
|
272
|
+
- Tokens are cached with `chmod 600` (owner-only read/write).
|
|
273
|
+
- Browser state saved for SSO — avoids repeated logins.
|
|
274
|
+
- `send`, `chat-send`, `react`, `unreact`, `schedule`, `send-file`, `set-status` ask for confirmation by default (use `-y` to skip).
|
|
275
|
+
- Anti-detection: random jitter between requests (0.3s reads, 2.0s writes), full browser headers.
|
|
276
|
+
- Do not share or log bearer tokens — they grant full Teams access.
|
|
277
|
+
- Prefer `teams login` over manually copying tokens.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*.egg-info/
|
|
6
|
+
*.egg
|
|
7
|
+
.eggs/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.venv/
|
|
11
|
+
env/
|
|
12
|
+
|
|
13
|
+
# Testing
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.coverage
|
|
16
|
+
htmlcov/
|
|
17
|
+
.tox/
|
|
18
|
+
|
|
19
|
+
# Type checking / linting
|
|
20
|
+
.mypy_cache/
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
|
|
23
|
+
# IDE
|
|
24
|
+
.vscode/
|
|
25
|
+
.idea/
|
|
26
|
+
*.iml
|
|
27
|
+
*.swp
|
|
28
|
+
*.swo
|
|
29
|
+
*~
|
|
30
|
+
|
|
31
|
+
# OS
|
|
32
|
+
.DS_Store
|
|
33
|
+
Thumbs.db
|
|
34
|
+
|
|
35
|
+
# Environment
|
|
36
|
+
.env
|
|
37
|
+
.env.*
|
|
38
|
+
|
|
39
|
+
# Playwright CLI artifacts (may contain session data)
|
|
40
|
+
.playwright-cli/
|
|
41
|
+
|
|
42
|
+
# Teams CLI sensitive/cache files (normally in ~/.cache, but just in case)
|
|
43
|
+
tokens.json
|
|
44
|
+
token.json
|
|
45
|
+
browser-state.json
|
|
46
|
+
id_map.json
|
|
47
|
+
scheduled.json
|
|
48
|
+
user_profile.json
|