Skip to content

Update quoted replies & new quotes features#482

Merged
corinagum merged 15 commits into
mainfrom
cg/quoted-replies
May 7, 2026
Merged

Update quoted replies & new quotes features#482
corinagum merged 15 commits into
mainfrom
cg/quoted-replies

Conversation

@corinagum

@corinagum corinagum commented Mar 23, 2026

Copy link
Copy Markdown
Collaborator
image
  • Remove withReplyToId(): replyToId body property has no effect on threading (APX only uses it for encryption)
  • Add QuotedReplyEntity type with nested quotedReply data object (messageId required, senderId/senderName/preview/time/isReplyDeleted/validatedMessageReference optional)
  • Add getQuotedMessages() on MessageActivity to read inbound quoted reply entities
  • Add addQuotedReply(messageId, response?) builder on MessageActivity for constructing outbound quotes (build order = reading order)
  • Update reply() to stamp quotedReply entity + <quoted messageId="..."/> placeholder instead of blockquote HTML; remove replyToId assignment
  • Add quoteReply(messageId, activity) on ActivityContext for quoting arbitrary messages
  • Mark all quoted reply types and methods as @experimental
  • Fix bug in ActivityContext constructor where Object.assign(this, rest) ran before MessageActivity.from().toInterface(), causing interface methods (getQuotedMessages, stripMentionsText, isRecipientMentioned, getAccountMention) to be missing on context.activity. Added regression test.
  • Add quoted-replies example exercising all APIs

@corinagum
corinagum marked this pull request as ready for review March 24, 2026 18:19
@corinagum
corinagum requested a review from Copilot March 24, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the SDK’s reply/quote behavior to use Teams “quoted replies” (entity + <quoted .../> placeholder) instead of replyToId/blockquote HTML, adds first-class quoted-reply types/APIs, fixes an ActivityContext constructor enrichment bug, and introduces an example app to exercise the new functionality.

Changes:

  • Add QuotedReplyEntity/QuotedReplyData, plumb into Entity union, and add MessageActivity.getQuotedMessages() + addQuotedReply().
  • Update ActivityContext.reply() to stamp quoted-reply metadata + placeholder, and add ActivityContext.quoteReply(messageId, ...).
  • Fix ActivityContext constructor ordering bug (enrichment before Object.assign) and add regression tests + a new quoted-replies example.

Reviewed changes

Copilot reviewed 16 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/apps/src/contexts/activity.ts Adds quoteReply() API, changes reply() quoting behavior, and fixes constructor activity enrichment ordering.
packages/apps/src/contexts/activity.test.ts Updates tests to assert quoted-reply entity + placeholder behavior for reply() and quoteReply().
packages/apps/src/app.process.spec.ts Regression test ensuring message activities are enriched with interface methods (e.g., getQuotedMessages).
packages/api/src/models/entity/quoted-reply-entity.ts Introduces QuotedReplyEntity and nested quoted reply data model.
packages/api/src/models/entity/index.ts Exposes QuotedReplyEntity via the Entity union and exports.
packages/api/src/activities/message/message.ts Adds getQuotedMessages() and addQuotedReply() builder API.
packages/api/src/activities/message/message.spec.ts Adds unit tests for quoted-reply parsing and builder behavior.
packages/api/src/activities/activity.ts Removes withReplyToId() builder method.
packages/api/src/activities/activity.spec.ts Updates tests to reflect removal of withReplyToId().
package-lock.json Adds the new @examples/quoted-replies workspace entry.
examples/quoted-replies/** New runnable example demonstrating reading/sending quoted replies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/apps/src/contexts/activity.ts Outdated
Comment thread packages/apps/src/contexts/activity.ts Outdated
Comment thread packages/apps/src/contexts/activity.ts Outdated
Comment thread packages/apps/src/contexts/activity.ts
Comment thread packages/api/src/activities/message/message.ts
Comment thread packages/api/src/activities/activity.ts
@corinagum corinagum changed the title Update quoted replies Update quoted replies & new quotes features Mar 25, 2026
Comment thread packages/api/src/activities/message/message.ts Outdated
Comment thread packages/api/src/models/entity/quoted-reply-entity.ts
Comment thread packages/apps/src/contexts/activity.ts
Comment thread packages/apps/src/contexts/activity.ts
Comment thread packages/apps/src/contexts/activity.ts Outdated
Comment thread packages/apps/src/contexts/activity.ts Outdated
Comment thread packages/apps/src/contexts/activity.ts
Comment thread packages/apps/src/contexts/activity.ts Outdated
heyitsaamir
heyitsaamir previously approved these changes Mar 26, 2026

@heyitsaamir heyitsaamir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lg2m. Lmk if we change between quoteReply and quote. Both sound ok to me!

heyitsaamir
heyitsaamir previously approved these changes Mar 26, 2026
@corinagum

Copy link
Copy Markdown
Collaborator Author

Re: Copilot review comments

  • messageId escaping: messageId is an APX-controlled IC3 ID, not user input. No escaping needed.
  • Non-message activity guard on reply(): Handled in quote() — non-message activities bypass entity stamping.
  • withReplyToId() removal: Intentional.
  • Entity order in prependQuote: Entity position in the list doesn't affect rendering; APX matches by type.
  • "preview" wording: Updated to "coming soon."

@corinagum
corinagum force-pushed the cg/quoted-replies branch from 0596f05 to d7ffcb2 Compare April 7, 2026 19:16
@corinagum
corinagum force-pushed the cg/quoted-replies branch 2 times, most recently from d36b8ac to 2734f5b Compare April 27, 2026 21:53
corinagum added a commit that referenced this pull request May 6, 2026
PR #482 left a stale examples/quoted-replies entry (directory was
renamed to examples/quoting), and the lockfile predated PR #536's
examples/targeted-messages workspace. npm ci enforces lockfile
against workspace globs and was failing in CI; npm install tolerated
the drift. Regenerated from scratch so both new example workspaces
are present and the stale one is gone.
@corinagum
corinagum force-pushed the cg/quoted-replies branch from 292f241 to b8d2c39 Compare May 6, 2026 23:10

@heyitsaamir heyitsaamir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Minor NIT.

Also, does package-lock need changing?

@corinagum
corinagum force-pushed the cg/quoted-replies branch from b8d2c39 to 8ce52b6 Compare May 7, 2026 17:47
Corina Gum and others added 6 commits May 7, 2026 10:48
The lockfile had a stale examples/quoted-replies entry left over from
the directory rename to examples/quoting, which caused 'npm ci' to
fail in CI (npm install tolerated the drift). Regenerated from
scratch so the lockfile matches the actual workspace layout.
@corinagum
corinagum force-pushed the cg/quoted-replies branch from 8ce52b6 to 67aaffd Compare May 7, 2026 17:48
@corinagum
corinagum merged commit bc4498d into main May 7, 2026
8 checks passed
@corinagum
corinagum deleted the cg/quoted-replies branch May 7, 2026 17:59
corinagum added a commit that referenced this pull request May 14, 2026
## Summary

Brings `main` into `release` for the 2.0.11 release, with quoted-replies
(PR #482) excluded.

Single squashed commit containing the diff between `release` (2.0.10)
and `main`, minus the quoted-replies feature.

## What's in this release

- All commits merged to main since 2.0.10 (the previous release),
notably:
- **Reactions GA** (PR #575) — `[Experimental]` removed;
`ReactionClient.remove()` → `delete()`
  - User-agent fix (PR #573)
  - Prompt Preview Support (PR #536)
  - Various dependency bumps and bug fixes

## What's NOT in this release

**Quoted-replies feature (PR #482) is excluded:**
- `prependQuote()`, `addQuote()` builder methods — absent
- `context.quote()` and quote-aware `reply()` behavior — reverted to
legacy `replyToId` + blockquote
- `examples/quoting` — removed
- QR-related tests — removed

**Kept intentionally:**
- `QuotedReplyEntity` type stays in the `Entity` union so inbound
activities carrying `quotedReply` entities still parse
- `addTargetedMessageInfo` runtime strip-QR logic (filters `e.type ===
'quotedReply'`) — preserves prompt-preview cleanup

## Version

`version.json`: `2.0.10` → `2.0.11`

## Test plan

- [x] `npm run lint` — 33/33 packages
- [x] `npm run build` — 35/35 packages
- [x] `npm run test` — 730/730 tests across 61 suites
- [x] `npm pack --workspaces` — all tarballs produced; verified
`quoted-reply-entity.d.ts` ships in `@microsoft/teams.api`; no
`prependQuote`/`addQuote` symbols in bundled `dist/`
- [ ] ADO Public publish pipeline (post-merge)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

## CI note

skip-test-verification — the `release` branch is out of sync with `main`
for three template/example pairs (templates: `ai`; examples: `echo`,
`graph`). This PR brings them along as part of the bulk main→release
merge but doesn't try to re-pair them, since that's an orthogonal fix
and would muddy this PR's "single squashed release diff" intent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants