Skip to content

Comments

Add support for Targeted Messages#264

Merged
heyitsaamir merged 4 commits intomicrosoft:mainfrom
ShanmathiMayuramKrithivasan:shmayura/targeted-messages-v2
Jan 30, 2026
Merged

Add support for Targeted Messages#264
heyitsaamir merged 4 commits intomicrosoft:mainfrom
ShanmathiMayuramKrithivasan:shmayura/targeted-messages-v2

Conversation

@ShanmathiMayuramKrithivasan
Copy link
Contributor

Adds support for targeted messages that only a specific recipient can see in a conversation.

Usage

# Target the sender from context
await send(MessageActivityInput(text="Only you see this").with_targeted_recipient(True))

# Target a specific user
await send(MessageActivityInput(text="Private").with_targeted_recipient("user-id"))

Key Changes

  • SDK appends ?isTargetedActivity=true to API calls, so backend services handles the messages accordingly
  • Supports create, update, delete, and reply operations
  • Includes tests and example bot

Copilot AI review requested due to automatic review settings January 28, 2026 12:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class support for “targeted” (recipient-scoped) message activities by routing targeted sends/updates through specialized conversation APIs and providing an example bot.

Changes:

  • Add is_targeted + with_targeted_recipient(...) on MessageActivityInput to mark messages as targeted and optionally set a recipient.
  • Route app-layer sends/updates to new API client methods that append ?isTargetedActivity=true.
  • Add an example app and unit tests covering the new model/client surfaces.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
uv.lock Adds the new examples/targeted-messages workspace package to the lock/workspace members.
packages/apps/src/microsoft_teams/apps/routing/activity_context.py Infers recipient for targeted sends in reactive contexts (sender-targeted).
packages/apps/src/microsoft_teams/apps/http_plugin.py Chooses targeted vs non-targeted create/update API routes based on is_targeted.
packages/apps/src/microsoft_teams/apps/app.py Validates proactive targeted sends require an explicit recipient.
packages/api/tests/unit/test_message_activities.py Adds tests for with_targeted_recipient and serialization of isTargeted.
packages/api/tests/unit/test_conversation_client.py Adds tests for the new targeted activity operations.
packages/api/src/microsoft_teams/api/clients/conversation/client.py Exposes create_targeted/update_targeted/delete_targeted on activity operations.
packages/api/src/microsoft_teams/api/clients/conversation/activity.py Implements targeted create/update/delete URLs using isTargetedActivity=true.
packages/api/src/microsoft_teams/api/activities/message/message.py Introduces is_targeted field and builder method with_targeted_recipient.
examples/targeted-messages/src/main.py Adds a runnable bot demonstrating targeted send/reply/update/delete flows.
examples/targeted-messages/pyproject.toml Adds new example package definition and dependencies.
examples/targeted-messages/README.md Documents commands and how targeted messages work.

Copy link
Collaborator

@heyitsaamir heyitsaamir left a comment

Choose a reason for hiding this comment

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

minor comments, but overall looks good. Once you make these changes, I'll merge it

@heyitsaamir heyitsaamir merged commit 1a8f20d into microsoft:main Jan 30, 2026
4 checks passed
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