Adding bot-targeted-messages nodejs sample#1966
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Microsoft Teams SDK (Node.js/TypeScript) sample demonstrating targeted messages by implementing a reminder bot that sends confirmations and reminders visible only to intended recipients in channels/group chats.
Changes:
- Introduces a new Node.js/TypeScript reminder bot sample using
MessageActivity.withRecipient()and proactiveapp.send(). - Adds sample metadata (
assets/sample.json) and setup documentation (README.md,.env.TEMPLATE). - Adds NPM project configuration for running the sample.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/package.json | Defines sample runtime scripts and Teams SDK dependencies. |
| samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/package-lock.json | Adds an npm lockfile for the sample dependency graph. |
| samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/index.ts | Implements reminder workflow + Adaptive Card actions with targeted/proactive messaging. |
| samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/assets/sample.json | Registers sample metadata for catalog/discovery. |
| samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/README.md | Documents usage, commands, and how targeted messaging is applied. |
| samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/.env.TEMPLATE | Provides environment variable template for local configuration. |
Files not reviewed (1)
- samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/package-lock.json: Language not supported
| const mentioned = extractMentionedUser(msg, botId); | ||
| if (mentioned) { | ||
| targetUserId = mentioned.userId; | ||
| targetUserName = mentioned.userName; | ||
| // Use SDK's built-in stripMentionsText to remove target user's mention from text | ||
| text = stripMentionsText(msg, { accountId: mentioned.userId })?.trim() || text; | ||
| } else { |
There was a problem hiding this comment.
In parseReminderCommand, when a target user is mentioned you replace text with stripMentionsText(msg, { accountId: mentioned.userId }), which operates on msg.text (the original activity text) rather than the already-processed commandText. This can reintroduce the bot mention / other text that was previously stripped and lead to incorrect parsing of the reminder message. Prefer stripping/removing the target mention from the local text/commandText instead of re-deriving from the raw activity.
|
|
||
| You can run these samples locally using: | ||
|
|
||
| 1. In the Teams Client after you have provisioned the Teams Application and configured the application with your local DevTunnels URL. |
There was a problem hiding this comment.
Lines 67-69 are difficult to understand. I see "You can run these samples locally using:" and expect a list but there is the sentence "In the teams client..."
MSFTRickyCastaneda
left a comment
There was a problem hiding this comment.
Just one comment on formatting / clarity. I have not reviewed or tested sample code. Engineering should take a pass.
No description provided.