Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

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 <14916339+rido-min@users.noreply.github.com>
- Remove unnecessary undefined check in withRecipient
- Keep test pattern for update scenario consistent with original implementation

Co-authored-by: rido-min <14916339+rido-min@users.noreply.github.com>
- 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 <14916339+rido-min@users.noreply.github.com>
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
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.

2 participants