Skip to content

Refactor targeted messaging API to consolidate recipient and targeting flags#449

Merged
corinagum merged 11 commits into
mainfrom
copilot/apply-changes-from-pr-318
Feb 18, 2026
Merged

Refactor targeted messaging API to consolidate recipient and targeting flags#449
corinagum merged 11 commits into
mainfrom
copilot/apply-changes-from-pr-318

Conversation

Copilot AI commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

use skip-test-verification

Applies the targeted messaging API refactor from microsoft/teams.net#318. The change consolidates withTargetedRecipient() into an enhanced withRecipient() method, making targeted message creation more explicit and reducing API surface area.

API Changes

Before:

// Implicit recipient inference
new MessageActivity('message').withTargetedRecipient(true)

// Recipient by ID only
new MessageActivity('message').withTargetedRecipient('user-123')

After:

// Explicit recipient with targeting flag
new MessageActivity('message').withRecipient(activity.from, true)

// Full account object
new MessageActivity('message').withRecipient(
  { id: 'user-123', name: 'User', role: 'user' },
  true
)

Implementation

  • Moved isTargeted from MessageActivity to base Activity class as non-nullable boolean (default false)
  • Enhanced Activity.withRecipient(account, isTargeted?) to accept optional targeting flag
  • Removed MessageActivity.withTargetedRecipient() method
  • Updated interface definitions to reflect property relocation
  • Updated examples and tests to use new API pattern
  • Updated validation error messages

Breaking Changes

The withTargetedRecipient() method is removed. Callers must migrate to withRecipient(account, true).


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 11, 2026 21:17
- Move isTargeted from MessageActivity to base Activity class as non-nullable boolean
- Update withRecipient in Activity to accept optional isTargeted parameter
- Override withRecipient in MessageActivity to maintain return type
- Remove withTargetedRecipient method from MessageActivity
- Update all examples and tests to use new API pattern
- Update validation error messages
- Add isTargeted property to devtools feedback activity

Co-authored-by: rido-min <[email protected]>
- Remove unnecessary undefined check in withRecipient
- Keep test pattern for update scenario consistent with original implementation

Co-authored-by: rido-min <[email protected]>
- Add JSDoc documentation for isTargeted parameter in Activity.withRecipient
- Improve comment explaining why isTargeted is set directly in update test

Co-authored-by: rido-min <[email protected]>
Copilot AI changed the title [WIP] Apply changes from PR #318 of teams.net Refactor targeted messaging API to consolidate recipient and targeting flags Feb 11, 2026
Copilot AI requested a review from rido-min February 11, 2026 21:24
@rido-min
rido-min marked this pull request as ready for review February 11, 2026 21:26
@rido-min
rido-min requested a review from corinagum as a code owner February 11, 2026 21:26
Comment thread packages/api/src/activities/message/message.ts Outdated
Comment thread package-lock.json
Comment thread packages/api/src/activities/message/message.ts Outdated
Comment thread packages/api/src/activities/activity.ts

@corinagum corinagum 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.

Not sure about the override, nor the package-lock.json touch.

Comment thread .github/workflows/build-test-lint.yml

@rajan-chari rajan-chari 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.

LGTM Thanks

@corinagum
corinagum merged commit 70439c4 into main Feb 18, 2026
8 of 9 checks passed
@corinagum
corinagum deleted the copilot/apply-changes-from-pr-318 branch February 18, 2026 17:24
@heyitsaamir heyitsaamir mentioned this pull request Mar 25, 2026
2 tasks
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.

5 participants