Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samples/bot-message-reaction/nodejs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# TeamsFx files
env/.env.*.user
env/.env.local
.localConfigs.testTool
.localConfigs.playground
.localConfigs
.notification.localstore.json
.notification.testtoolstore.json
.notification.playgroundstore.json
appPackage/build

# dependencies
Expand Down
3 changes: 0 additions & 3 deletions samples/bot-message-reaction/nodejs/.localConfigs

This file was deleted.

3 changes: 0 additions & 3 deletions samples/bot-message-reaction/nodejs/.localConfigs.testTool

This file was deleted.

12 changes: 6 additions & 6 deletions samples/bot-message-reaction/nodejs/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"name": "Launch Remote (Desktop)",
"type": "node",
"request": "launch",
"preLaunchTask": "Start Teams App in Desktop Client (Remote)",
"preLaunchTask": "Start App in Desktop Client (Remote)",
"presentation": {
"group": "3-remote",
"order": 3
Expand All @@ -84,7 +84,7 @@
"Launch App (Edge)",
"Attach to Local Service"
],
"preLaunchTask": "Start Teams App Locally",
"preLaunchTask": "Start App Locally",
"presentation": {
"group": "2-local",
"order": 1
Expand All @@ -97,7 +97,7 @@
"Launch App (Chrome)",
"Attach to Local Service"
],
"preLaunchTask": "Start Teams App Locally",
"preLaunchTask": "Start App Locally",
"presentation": {
"group": "2-local",
"order": 2
Expand All @@ -109,19 +109,19 @@
"configurations": [
"Attach to Local Service"
],
"preLaunchTask": "Start Teams App in Desktop Client",
"preLaunchTask": "Start App in Desktop Client",
"presentation": {
"group": "2-local",
"order": 3
},
"stopAll": true
},
{
"name": "Debug in Test Tool",
"name": "Debug in Microsoft 365 Agents Playground",
"configurations": [
"Attach to Local Service"
],
"preLaunchTask": "Start Teams App (Test Tool)",
"preLaunchTask": "Start App in Microsoft 365 Agents Playground",
"presentation": {
"group": "1-local",
"order": 1
Expand Down
113 changes: 98 additions & 15 deletions samples/bot-message-reaction/nodejs/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,102 @@
"version": "2.0.0",
"tasks": [
{
"label": "Start Teams App (Test Tool)",
"label": "Start Agent (Sandbox)",
"dependsOn": [
"Validate prerequisites (Test Tool)",
"Deploy (Test Tool)",
"Start application (Test Tool)",
"Start Test Tool",
"Validate prerequisites (Sandbox)",
"Start local tunnel (Sandbox)",
"Provision (Sandbox)",
"Deploy (Sandbox)",
"Start application",
"Sideload App to channel"
],
"dependsOrder": "sequence"
},
{
// Check all required prerequisites.
// See https://aka.ms/teamsfx-tasks/check-prerequisites to know the details and how to customize the args.
"label": "Validate prerequisites (Sandbox)",
"type": "teamsfx",
"command": "debug-check-prerequisites",
"args": {
"prerequisites": [
"portOccupancy",
"sandbox",
"nodejs"
],
"portOccupancy": [
3978,
9239
]
}
},
{
// Start the local tunnel service to forward public URL to local port and inspect traffic.
// See https://aka.ms/teamsfx-tasks/local-tunnel for the detailed args definitions.
"label": "Start local tunnel (Sandbox)",
"type": "teamsfx",
"command": "debug-start-local-tunnel",
"args": {
"type": "dev-tunnel",
"ports": [
{
"portNumber": 3978,
"protocol": "http",
"access": "public",
"writeToEnvironmentFile": {
"endpoint": "BOT_ENDPOINT",
"domain": "BOT_DOMAIN"
}
}
],
"env": "sandbox"
},
"isBackground": true,
"problemMatcher": "$teamsfx-local-tunnel-watch"
},
{
// Create the debug resources.
// See https://aka.ms/teamsfx-tasks/provision to know the details and how to customize the args.
"label": "Provision (Sandbox)",
"type": "teamsfx",
"command": "provision",
"args": {
"env": "sandbox"
}
},
{
// Build the project.
// See https://aka.ms/teamsfx-tasks/deploy to know the details and how to customize the args.
"label": "Deploy (Sandbox)",
"type": "teamsfx",
"command": "deploy",
"args": {
"env": "sandbox"
}
},
{
"label": "Sideload App to channel",
"type": "teamsfx",
"command": "install-app",
"args": {
"env": "sandbox",
"appPackagePath": "${workspaceFolder}/appPackage/build/appPackage.sandbox.zip"
}
},
{
"label": "Start App in Microsoft 365 Agents Playground",
"dependsOn": [
"Validate prerequisites (Microsoft 365 Agents Playground)",
"Deploy (Microsoft 365 Agents Playground)",
"Start application (Microsoft 365 Agents Playground)",
"Start Microsoft 365 Agents Playground",
],
"dependsOrder": "sequence"
},
{
// Check all required prerequisites.
// See https://aka.ms/teamsfx-tasks/check-prerequisites to know the details and how to customize the args.
"label": "Validate prerequisites (Test Tool)",
"label": "Validate prerequisites (Microsoft 365 Agents Playground)",
"type": "teamsfx",
"command": "debug-check-prerequisites",
"args": {
Expand All @@ -28,22 +111,22 @@
"portOccupancy": [
3978, // app service port
9239, // app inspector port for Node.js debugger
56150, // test tool port
56150, // Microsoft 365 Agents Playground port
]
}
},
{
// Build project.
// See https://aka.ms/teamsfx-tasks/deploy to know the details and how to customize the args.
"label": "Deploy (Test Tool)",
"label": "Deploy (Microsoft 365 Agents Playground)",
"type": "teamsfx",
"command": "deploy",
"args": {
"env": "testtool",
"env": "playground",
}
},
{
"label": "Start application (Test Tool)",
"label": "Start application (Microsoft 365 Agents Playground)",
"type": "shell",
"command": "npm run dev:teamsfx:testtool",
"isBackground": true,
Expand All @@ -67,7 +150,7 @@
}
},
{
"label": "Start Test Tool",
"label": "Start Microsoft 365 Agents Playground",
"type": "shell",
"command": "npm run dev:teamsfx:launch-testtool",
"isBackground": true,
Expand Down Expand Up @@ -104,7 +187,7 @@
}
},
{
"label": "Start Teams App Locally",
"label": "Start App Locally",
"dependsOn": [
"Validate prerequisites",
"Start local tunnel",
Expand All @@ -123,7 +206,7 @@
"args": {
"prerequisites": [
"nodejs", // Validate if Node.js is installed.
"m365Account", // Sign-in prompt for Microsoft 365 account, then validate if the account enables the uploading permission.
"m365Account", // Sign-in prompt for Microsoft 365 account, then validate if the account enables the sideloading permission.
"portOccupancy" // Validate available ports to ensure those debug ones are not occupied.
],
"portOccupancy": [
Expand Down Expand Up @@ -201,7 +284,7 @@
}
},
{
"label": "Start Teams App in Desktop Client",
"label": "Start App in Desktop Client",
"dependsOn": [
"Validate prerequisites",
"Start local tunnel",
Expand All @@ -221,7 +304,7 @@
}
},
{
"label": "Start Teams App in Desktop Client (Remote)",
"label": "Start App in Desktop Client (Remote)",
"type": "teamsfx",
"command": "launch-desktop-client",
"args": {
Expand Down
4 changes: 2 additions & 2 deletions samples/bot-message-reaction/nodejs/.webappignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.webappignore
.fx
.deployment
.localConfigs.testTool
.localConfigs.playground
.localConfigs
.notification.localstore.json
.notification.testtoolstore.json
.notification.playgroundstore.json
.vscode
*.js.map
*.ts.map
Expand Down
16 changes: 7 additions & 9 deletions samples/bot-message-reaction/nodejs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
page_type: sample
description: This sample app demonstrates how to use message reactions in Microsoft Teams with a bot built on the Bot Framework.
description: This sample app demonstrates how to use message reactions in Microsoft Teams with a bot built on the Teams SDK.
products:
- office-teams
- office
Expand All @@ -15,11 +15,11 @@ urlFragment: officedev-microsoft-teams-samples-bot-message-reaction-nodejs

# Teams Message Reactions Bot Node.js Sample

This sample app demonstrates the implementation of message reactions in Microsoft Teams using the Bot Framework. The bot responds dynamically to reactions, supporting personal, group, and team scopes, and is compatible with adaptive cards. It can be run locally with .NET SDK and tunneling solutions or deployed to Azure for broader use.
This sample app demonstrates the implementation of message reactions in Microsoft Teams using the Teams SDK. The bot responds dynamically to reactions, supporting personal, group, and team scopes. It can be run locally with Microsoft 365 Agents Toolkit or deployed to Azure for broader use.

## Included Features
* Bots
* Adaptive Cards
* Teams SDK

## Interaction with bot
![Message Reaction](Images/MessageReactions.gif)
Expand Down Expand Up @@ -107,8 +107,8 @@ In Azure portal, create a [Azure Bot resource](https://docs.microsoft.com/azure/
npm install
```

1) Update the `.env` configuration for the bot to use the Microsoft App Id and App Password from the Bot Framework registration. (Note the App Password is referred to as the "client secret" in the azure portal and you can always create a new client secret anytime.) `MicrosoftAppTenantId` will be the id for the tenant where application is registered.
- Also, set MicrosoftAppType in the `.env`. (**Allowed values are: MultiTenant(default), SingleTenant, UserAssignedMSI**)
1) Update the `config.js` configuration for the bot to use the Microsoft App Id and App Password from the Bot Framework registration. (Note the App Password is referred to as the "client secret" in the azure portal and you can always create a new client secret anytime.) `MicrosoftAppTenantId` will be the id for the tenant where application is registered.
- Also, set MicrosoftAppType in the `config.js`. (**Allowed values are: MultiTenant(default), SingleTenant, UserAssignedMSI**)

1) Run your bot at the command line:

Expand All @@ -117,9 +117,9 @@ In Azure portal, create a [Azure Bot resource](https://docs.microsoft.com/azure/
```

1) __*This step is specific to Teams.*__
- **Edit** the `manifest.json` contained in the `appManifest` folder to replace your Microsoft App Id (that was created when you registered your bot earlier) *everywhere* you see the place holder string `<<YOUR-MICROSOFT-APP-ID>>` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- **Edit** the `manifest.json` contained in the `appPackage` folder to replace your Microsoft App Id (that was created when you registered your bot earlier) *everywhere* you see the place holder string `{{TEAMS_APP_ID}}` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
- **Edit** the `manifest.json` for `validDomains` with base Url domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app` and if you are using dev tunnels then your domain will be like: `12345.devtunnels.ms`.
- **Zip** up the contents of the `appManifest` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- **Zip** up the contents of the `appPackage` folder to create a `manifest.zip` (Make sure that zip file does not contains any subfolder otherwise you will get error while uploading your .zip package)
- **Upload** the `manifest.zip` to Teams (In Teams Apps/Manage your apps click "Upload an app". Browse to and Open the .zip file. At the next dialog, click the Add button.)
- Add the app in personal/groupchat/team scope (supported scopes)

Expand Down Expand Up @@ -155,11 +155,9 @@ To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](htt

## Further reading

- [Bot Framework Documentation](https://docs.botframework.com)
- [Bot Basics](https://docs.microsoft.com/azure/bot-service/bot-builder-basics?view=azure-bot-service-4.0)
- [Azure Bot Service Introduction](https://docs.microsoft.com/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0)
- [Azure Bot Service Documentation](https://docs.microsoft.com/azure/bot-service/?view=azure-bot-service-4.0)
- [Teams Message Reaction Events](https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/subscribe-to-conversation-events?tabs=dotnet#message-reaction-events)


<img src="https://pnptelemetry.azurewebsites.net/microsoft-teams-samples/samples/bot-message-reaction-nodejs" />
Loading