Skip to content

Conversation

@ShanmathiMayuramKrithivasan
Copy link

@ShanmathiMayuramKrithivasan ShanmathiMayuramKrithivasan commented Jan 5, 2026

Add support for Targeted Messages
This PR introduces support for sending targeted messages - messages delivered privately to a specific recipient within a conversation.

Key Updates:
Added an is_targeted boolean parameter to the send, update, reply and Delete APIs. When enabled, the message is sent privately to the Recipient.Id specified in the activity payload.

We append isTargetedActivity=true as a query parameter in API URLs when isTargeted is set, allowing backend services to correctly process these requests.

Copilot AI review requested due to automatic review settings January 5, 2026 14:16
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

This PR introduces support for targeted messages in Microsoft Teams, allowing messages to be sent privately to specific recipients within a conversation. The implementation adds an is_targeted boolean parameter throughout the messaging pipeline and appends isTargetedActivity=true as a query parameter to API URLs when enabled.

Key changes:

  • Added is_targeted parameter to send, update, and reply operations across all layers (API, apps, devtools)
  • Implemented URL query parameter handling to append isTargetedActivity=true when targeted mode is enabled
  • Added validation to ensure activity.recipient is set when using targeted messages

Reviewed changes

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

Show a summary per file
File Description
packages/api/src/microsoft_teams/api/clients/conversation/activity.py Implements URL query parameter construction for targeted messages in create, update, and reply methods
packages/api/src/microsoft_teams/api/clients/conversation/client.py Propagates is_targeted parameter through the ActivityOperations interface
packages/api/tests/unit/test_conversation_client.py Adds comprehensive test coverage for targeted message operations
packages/apps/src/microsoft_teams/apps/http_plugin.py Implements recipient validation and conversation reference handling for targeted messages
packages/apps/src/microsoft_teams/apps/plugins/sender.py Updates the Sender protocol interface to include is_targeted parameter
packages/apps/src/microsoft_teams/apps/routing/activity_context.py Adds is_targeted parameter to send and reply methods with documentation
packages/apps/src/microsoft_teams/apps/contexts/function_context.py Implements recipient validation for targeted messages in function context
packages/apps/src/microsoft_teams/apps/app.py Adds targeted message support to the App's proactive send method
packages/apps/src/microsoft_teams/apps/app_process.py Propagates is_targeted parameter through the process layer
packages/apps/tests/test_function_context.py Updates test assertions to verify is_targeted parameter handling
packages/devtools/src/microsoft_teams/devtools/devtools_plugin.py Forwards is_targeted parameter to the HTTP plugin

Comment on lines 131 to 133
url = f"{self.service_url}/v3/conversations/{conversation_id}/activities/{activity_id}"
if is_targeted:
url += "?isTargetedActivity=true"
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you need to have "isTargeted" for delete messages?

Choose a reason for hiding this comment

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

Yes based on service side design, we need to pass isTargetedActivity for update and delete.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is being discussed

Returns:
The updated activity
"""
url = f"{self.service_url}/v3/conversations/{conversation_id}/activities/{activity_id}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you need to have "isTargeted" for update messages?

Choose a reason for hiding this comment

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

Yes based on service design, we need to pass isTargetedActivity for update and delete.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should you revisit that? That doesn't really make sense though right? After an activity is created, the fact that it's targeted/not targeted is irrelevant

Choose a reason for hiding this comment

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

These are currently required for correct routing in APX and IC3 so they invoke the targeted handlers and apply the right validations. If dropped, the call goes through the normal message route and the activity cannot be resolved.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So a user needs to record the fact that an activity is targeted or not if they want to update it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is being discussed

@heyitsaamir
Copy link
Collaborator

@ShanmathiMayuramKrithivasan have you tested this?

Returns:
The updated activity
"""
url = f"{self.service_url}/v3/conversations/{conversation_id}/activities/{activity_id}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should you revisit that? That doesn't really make sense though right? After an activity is created, the fact that it's targeted/not targeted is irrelevant

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.

Would you mind creating a new test for this?

cookiecutter templates/test -o examples. If you run this, it'll scaffold a new test for you. (This will help us maintain this feature in the future).

Returns:
The updated activity
"""
url = f"{self.service_url}/v3/conversations/{conversation_id}/activities/{activity_id}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

So a user needs to record the fact that an activity is targeted or not if they want to update it?

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