openclaw/extensions/msteams
velanir-ai-manager e84a0dde17
fix(msteams): surface quoted message body in Teams quote replies (#101856)
* fix(msteams): surface quoted message body in Teams quote replies

Teams sends the quoted text of a 1:1 DM quote-reply in <p itemprop="preview">
(a truncated snippet), not <p itemprop="copy"> which the parser matched. The
match failed, so quoteInfo was undefined and nothing was surfaced to the agent.

Fix 1 (primary): extractMSTeamsQuoteInfo now accepts copy OR preview (prefers
copy, falls back to preview) and captures the blockquote itemid as the quoted
message id.

Fix 2 (enhancement): when the quoted message id is known, fetch the full text
via the app-only Graph endpoint GET /chats/{chatId}/messages/{id} (permitted
with Chat.Read.All, unlike the delegated /me/chats listing) and use it as the
quote body. Restricted to chats (DM + group) whose Graph chat id is a 19: id;
any failure degrades to the truncated preview so message handling never breaks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(msteams): address review — DM-only full-text fetch, drop unsupported $select, fix mocks

Addresses ClawSweeper review on the quote-reply PR:

- Security (P1): restrict the app-only Graph full-text quote fetch to 1:1 DMs.
  Previously it ran for any non-channel chat, so in a group an allowlisted
  sender could quote a non-allowlisted member and the fetched full body would
  bypass the supplemental-quote visibility allowlist. Group/channel quotes keep
  the (now-surfaced) truncated preview from fix 1.
- Graph contract (P2): the get-chatMessage endpoint does not support OData
  query params; drop the ?$select=id,body that tenants enforcing the contract
  would reject (which would silently fall back to the preview).
- Tests (P1): add fetchChatMessageText to the two vi.mock(../graph-thread.js)
  factories prod now touches, and add a group-chat regression test proving the
  Graph full-text fetch does not fire for group quotes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(msteams): add redacted real Teams quote-reply proof screenshots

Real-behavior evidence for the quote-reply fix (personal names + avatars
redacted): a 1:1 DM where the bot now reads back the full quoted message.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs(msteams): remove committed proof screenshots from branch

Proof media should live as external PR artifacts, not in the product tree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(msteams): bound and prove quote enrichment

* test(msteams): use valid open DM fixture

---------

Co-authored-by: Yash Inani <yashinani@Yashs-MacBook-Pro.local>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-09 12:20:54 +01:00
..
src fix(msteams): surface quoted message body in Teams quote replies (#101856) 2026-07-09 12:20:54 +01:00
api.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
channel-config-api.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
channel-plugin-api.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
config-api.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
directory-contract-api.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
doctor-contract-api.test.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
doctor-contract-api.ts refactor: consolidate duplicated plugin state and doctor migration plumbing onto SDK seams (#99850) 2026-07-04 01:51:03 -07:00
index.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
npm-shrinkwrap.json chore: update dependencies (#100027) 2026-07-04 14:56:50 -04:00
openclaw.plugin.json
package.json chore: update dependencies (#100027) 2026-07-04 14:56:50 -04:00
README.md
runtime-api.ts
secret-contract-api.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
setup-entry.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
setup-plugin-api.ts
test-api.ts docs: document channel extension sources 2026-06-04 21:59:00 -04:00
tsconfig.json

OpenClaw Microsoft Teams

Official OpenClaw channel plugin for Microsoft Teams bot conversations.

Install from OpenClaw:

openclaw plugin add @openclaw/msteams

Configure the Teams bot credentials and trusted service URLs in OpenClaw, then connect the bot to the teams or chats where agents should operate.