-
Notifications
You must be signed in to change notification settings - Fork 25
Add support for Targeted Messages" #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 9d8250f.
| let url = `${this.serviceUrl}/v3/conversations/${conversationId}/activities`; | ||
| if (isTargeted) { | ||
| url += '?isTargetedActivity=true'; | ||
| } | ||
|
|
||
| const res = await this.http.post<Resource>(url, params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isTargetedActivity should be a URL param. http.post should have support for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the same for all the methods below as well.
| let url = `${this.serviceUrl}/v3/conversations/${conversationId}/activities`; | ||
| if (isTargeted) { | ||
| url += '?isTargetedActivity=true'; | ||
| } | ||
|
|
||
| const res = await this.http.post<Resource>(url, params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the same for all the methods below as well.
| from: this.ref.bot, | ||
| conversation: this.ref.conversation, | ||
| // Set recipient from ref.user if provided (for targeted messages) | ||
| ...(this.ref.user && { recipient: this.ref.user }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ShanmathiMayuramKrithivasan does this work with streaming? have you tested that?
| * @param isTargeted when true, sends the message privately to the recipient specified in activity.recipient | ||
| */ | ||
| async send(conversationId: string, activity: ActivityLike) { | ||
| async send(conversationId: string, activity: ActivityLike, isTargeted: boolean = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do targetedRecipientUserId here?
So users can do app.send(conversationId, "string message", targetedRecipientUserId); Right now it's not clear that isTargeted will lead to the method throwing under some circumstances.
With targetedRecipientUserId, toActivityParams does the work of setting the recipient id in the activity.
| from: ref.bot, | ||
| conversation: ref.conversation, | ||
| // Set recipient from ref.user if provided (for targeted messages) | ||
| ...(ref.user && { recipient: ref.user }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting this logic in toActivityParams might be better/cleaner
NOTE: This is reopening #427 because it needed some design work.
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 isTargeted 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.