Skip to content

Adding bot-targeted-messages nodejs sample#1966

Open
AjayJ12-MSFT wants to merge 6 commits intomainfrom
v-ajayjadhav/targetedMessageSample
Open

Adding bot-targeted-messages nodejs sample#1966
AjayJ12-MSFT wants to merge 6 commits intomainfrom
v-ajayjadhav/targetedMessageSample

Conversation

@AjayJ12-MSFT
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
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 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 proactive app.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

Comment thread samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/index.ts Outdated
Comment thread samples/TeamsSDK/bot-targeted-messages/nodejs/bot-targeted-messages/README.md Outdated
Comment on lines +86 to +92
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 {
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.

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.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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..."

Copy link
Copy Markdown

@MSFTRickyCastaneda MSFTRickyCastaneda left a comment

Choose a reason for hiding this comment

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

Just one comment on formatting / clarity. I have not reviewed or tested sample code. Engineering should take a pass.

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.

4 participants