MS Outlook + Teams Assistant (Desktop-first)
What this skill does
- - Inbox nagging (Outlook Desktop): find messages from the last 7 days that likely need a reply, then send reminders until dismissed.
- Email reply drafting: produce concise drafts that match the user’s tone rules (conversational, spartan, polite; simple English; short; reduce redundancy; avoid em dashes).
- Teams tracking (optional): if Microsoft Graph is configured and permitted by tenant policy, track recent Teams chat messages that likely need a reply and nag similarly.
Safety defaults
- - Do not auto-send emails or Teams messages.
- Create drafts in Outlook, or paste drafts into Telegram for approval.
- For reminders: send to Telegram by default; only send to Teams if explicitly enabled.
Setup (one time)
A) Outlook Desktop automation (recommended)
- 1. Ensure Outlook Desktop is installed and signed in.
- Install the Python dependency (ask before doing this on the machine):
-
pip install pywin32
- 3. Create a config file:
- Copy
references/config.example.json →
references/config.json and fill it.
- IMPORTANT: Do not commit
references/config.json if it contains personal IDs.
B) Teams via Graph (optional)
Only if you can create an Entra ID app registration and grant permissions.
- - Copy
references/config.example.json → references/config.json and fill teams.tenantId, teams.clientId, and teams.scopes. - Then run
scripts/teams_scan.py once to complete Device Code sign-in.
See references/teams-graph-setup.md.
Core workflows
1) Scan and remind (Outlook)
Use scripts/scan_outlook.py.
1b) Scan Teams (Graph)
Use scripts/teams_scan.py.
Parameters:
First run will print a device code sign-in message (follow it once).
Parameters:
- -
--days 7 (default) - INLINECODE15 (default: report)
- INLINECODE16
Heuristics (editable in config):
- - Within last N days
- Not from obvious broadcast sources
- Prefer threads where user is To: (not only CC) OR subject/body contains direct asks
- Prefer messages not replied by user (best-effort)
Output:
- - A list of actionable items with: subject, sender, received time, why it was flagged.
Then:
- - If
--mode telegram, send a single concise reminder message with bullet items.
2) Dismiss / snooze an item
This skill uses a local state file to avoid nag loops.
- - Dismiss: add the message’s
internetMessageId (or subject+timestamp fallback) to the dismissed list. - Snooze: store a
snoozeUntil timestamp.
Use scripts/state.py helpers (or edit JSON directly if needed).
3) Draft an email reply (Outlook)
Use scripts/draft_reply.py.
4) Generate reminders (no send)
Use scripts/scan_all.py to update cached scan results, then scripts/remind.py to generate a Telegram-ready reminder message (it does not send).
It applies:
- - 1:1 Teams → remind when INLINECODE24
- Group Teams → remind when
mentionedMe=true AND INLINECODE26 - Outlook → remind for flagged items
The agent should send the output to Telegram if non-empty.
Inputs:
- - Either a message
EntryID (preferred) or search by subject + recent window.
Behavior:
- - Extract the thread (best-effort) + key metadata.
- Generate 2 drafts:
-
Short (2–5 sentences)
-
Normal (5–10 sentences)
- - Apply tone rules from
references/writing-style.md.
Outputs:
- - Print drafts to stdout.
- Optionally create an Outlook draft reply (no sending) if
--create-draft is set.
When you need more context from the user
Ask only what you cannot infer:
- - Which email to reply to (subject / sender / when)
- The user’s intent (agree/decline/ask for info/confirm timeline)
- Any constraints (deadlines, attachments, names)
Keep questions minimal (max 3 at a time).
MS Outlook + Teams 助手(桌面优先)
技能功能
- - 收件箱提醒(Outlook 桌面版):查找过去7天内可能需要回复的邮件,并持续发送提醒直至用户忽略。
- 邮件回复草稿生成:生成符合用户语气规则(口语化、简洁、礼貌;简单英语;简短;减少冗余;避免使用破折号)的简明草稿。
- Teams 消息追踪(可选):若已配置 Microsoft Graph 且租户策略允许,追踪近期可能需要回复的 Teams 聊天消息并发送类似提醒。
安全默认设置
- - 不自动发送邮件或 Teams 消息。
- 在 Outlook 中创建草稿,或粘贴草稿至 Telegram 等待审批。
- 提醒功能:默认发送至 Telegram;仅当明确启用时发送至 Teams。
初始配置(一次性)
A) Outlook 桌面版自动化(推荐)
- 1. 确保已安装并登录 Outlook 桌面版。
- 安装 Python 依赖(操作前请先询问):
- pip install pywin32
- 3. 创建配置文件:
- 复制 references/config.example.json → references/config.json 并填写内容。
- 重要提示:若 references/config.json 包含个人身份信息,请勿提交至版本控制。
B) 通过 Graph 集成 Teams(可选)
仅当您能创建 Entra ID 应用注册并授予权限时适用。
- - 复制 references/config.example.json → references/config.json 并填写 teams.tenantId、teams.clientId 和 teams.scopes。
- 然后运行 scripts/teams_scan.py 一次以完成设备代码登录。
详见 references/teams-graph-setup.md。
核心工作流程
1) 扫描并提醒(Outlook)
使用 scripts/scan_outlook.py。
1b) 扫描 Teams(Graph)
使用 scripts/teams_scan.py。
参数:
首次运行将打印设备代码登录提示(按提示操作一次)。
参数:
- - --days 7(默认值)
- --mode report|telegram(默认:report)
- --max-items 200
启发式规则(可在配置中编辑):
- - 最近N天内
- 非明显广播来源
- 优先处理用户处于收件人:(而非仅抄送)的线程,或主题/正文包含直接询问的内容
- 优先处理用户尚未回复的消息(尽力而为)
输出:
- - 可操作项目列表,包含:主题、发件人、接收时间、标记原因。
后续操作:
- - 若使用 --mode telegram,发送一条包含项目列表的简明提醒消息。
2) 忽略/暂缓项目
本技能使用本地状态文件避免重复提醒。
- - 忽略:将消息的 internetMessageId(或主题+时间戳作为备选)添加至忽略列表。
- 暂缓:存储 snoozeUntil 时间戳。
使用 scripts/state.py 辅助工具(或根据需要直接编辑 JSON 文件)。
3) 生成邮件回复草稿(Outlook)
使用 scripts/draft_reply.py。
4) 生成提醒(不发送)
使用 scripts/scan_all.py 更新缓存的扫描结果,然后使用 scripts/remind.py 生成适用于 Telegram 的提醒消息(不实际发送)。
应用规则:
- - 一对一 Teams 消息 → 当 needsReply=true 时提醒
- 群组 Teams 消息 → 当 mentionedMe=true 且 needsReply=true 时提醒
- Outlook → 对标记项目进行提醒
代理应将非空输出发送至 Telegram。
输入:
- - 消息的 EntryID(优先)或通过主题+近期时间窗口搜索。
行为:
- - 提取线程内容(尽力而为)+ 关键元数据。
- 生成两个草稿版本:
-
简短版(2-5句话)
-
标准版(5-10句话)
- - 应用 references/writing-style.md 中的语气规则。
输出:
- - 将草稿打印至标准输出。
- 若设置 --create-draft 参数,可选择在 Outlook 中创建回复草稿(不发送)。
需要用户提供更多上下文时
仅询问您无法推断的信息:
- - 需要回复哪封邮件(主题/发件人/时间)
- 用户的意图(同意/拒绝/询问信息/确认时间线)
- 任何限制条件(截止日期、附件、姓名)
保持问题简洁(每次最多3个)。