This sample bot showcases proactive messaging capabilities in Microsoft Teams by storing user conversation references to send scheduled or triggered reminder notifications. The app is designed for local debugging and deployment to Azure, offering full integration with Teams Toolkit for streamlined setup and testing.
- NodeJS
- An M365 account. If you do not have M365 account, apply one from M365 developer program
- Teams Toolkit Visual Studio Code Extension version after 1.55 or Teams Toolkit CLI
- From Visual Studio Code: Start debugging the project by hitting the
F5
key in Visual Studio Code. - Alternatively use the
Run and Debug Activity Panel
in Visual Studio Code and click theRun and Debug
green arrow button. - From Teams Toolkit CLI:
- Install dev tunnel cli.
- Login with your M365 Account using the command
devtunnel user login
. - Start your local tunnel service by running the command
devtunnel host -p 3978 --protocol http --allow-anonymous
. - In the
env/.env.local
file, fill in the values forPROVISIONOUTPUT__BOTOUTPUT__VALIDDOMAIN
andPROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT
with your dev tunnel URL.PROVISIONOUTPUT__BOTOUTPUT__VALIDDOMAIN=sample-id-3978.devtunnels.ms PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT=https://sample-id-3978.devtunnels.ms
- Executing the command
teamsapp provision --env local
in your project directory. - Executing the command
teamsapp deploy --env local
in your project directory. - Executing the command
teamsapp preview --env local --run-command "cd bot; npm run dev:teamsapp"
in your project directory.
Note: If deploying or provisioning the sample, please replace line 9 of file bot/teamsBot.js
with .env.dev. (By default its set to .env.local
)
You can find the Teams app manifest in templates/appPackage
folder. The folder contains a manifest template file:
manifest.template.json
Both files contain template arguments with {...}
statements which will be replaced at build time. You can hover the prepoerties to see the actual value or preview the manifest. You may add any extra properties or permissions you require to this file. See the schema reference for more information.
Note: If you are facing any issue in your app, please uncomment this line and put your debugger for local debug.
Important Notes! This sample is under upgrading, please expect errors if you attempted to provision and deploy the app to cloud. Once the sample complete upgrading, this notice will be removed. And the sample will be ready to be deployed to cloud by then. Before that, please debug and run this sample app locally!
Deploy your project to Azure by following these steps:
From Visual Studio Code | From Teams Toolkit CLI |
---|---|
|
|
Note: Provisioning and deployment may incur charges to your Azure Subscription.
Once the provisioning and deployment steps are finished, you can preview your app:
-
From Visual Studio Code
- Open the
Run and Debug Activity Panel
. - Select
Launch Remote (Edge)
orLaunch Remote (Chrome)
from the launch configuration drop-down. - Press the Play (green arrow) button to launch your app - now running remotely from Azure.
- Open the
-
From Teams Toolkit CLI: execute
teamsapp preview --env dev
in your project directory to launch your application.
To check that your manifest file is valid:
- From Visual Studio Code: open the command palette and select:
Teams: Validate manifest file
. - From Teams Toolkit CLI: run command
teamsapp validate
in your project directory.
- From Visual Studio Code: open the Teams Toolkit and click
Zip Teams metadata package
or open the command palette and selectTeams: Zip Teams metadata package
. - Alternatively, from the command line run
teamsapp package
in the project directory.
Once deployed, you may want to distribute your application to your organization's internal app store in Teams. Your app will be submitted for admin approval.
- From Visual Studio Code: open the Teams Toolkit and click
Publish to Teams
or open the command palette and select:Teams: Publish to Teams
. - From Teams Toolkit CLI: run command
teamsapp publish
in your project directory.
This sample provides following functionality:
-
You can send any command to bot to get the same message echoed back.
-
You can navigate to http://localhost:3978/api/notify to proactively message everyone who has previously messaged this bot.