This sample showcases an app that send a message to Teams with Adaptive Cards triggered by a HTTP post request. You can further extend the sample to consume, transform and post events to individual, chat or channel in Teams.
The app is built using the TeamsFx SDK, which provides a simple set of functions over the Microsoft Bot Framework to implement this scenario.
- How to use Teams Toolkit build a notification app.
- How to use Codespaces to run and preview a message extension in Teams.
- A GitHub account which will be used to create a codespace with fully configured dev environments in the cloud.
- A Microsoft 365 tenant in which you have permission to upload Teams apps. You can get a free Microsoft 365 developer tenant by joining the Microsoft 365 developer program.
-
Click Open in GitHub Codespaces badge to create a codespace for the sample app.
Note: you can customize the creation options (e.g. region, machine type) according to your needs.
-
Once your codespace is created, Select the Teams Toolkit icon on the left in the VS Code toolbar. And then select
Preview your Teams app (F5)
from Teams Toolkit or simply pressF5
to run and preview your application. -
When Teams Web Client is launched in the browser, select the
Add
button in the dialog to install your app to Teams.Note: You may need to allow pop-ups so that Codespace can open a new browser to sideload the app to Teams:
-
Open a terminal in your Codespaces, and send a POST request to the app with the following command:
curl -X POST http://localhost:3978/api/notification
The application will send an Adaptive Card to Teams:
- From VS Code:
- Sign into Azure by clicking the
Sign in to Azure
under theACCOUNTS
section from sidebar. - Click
Provision
fromLIFECYCLE
section or open the command palette and select:Teams: Provision
. - Click
Deploy
or open the command palette and select:Teams: Deploy
.
- Sign into Azure by clicking the
- From Teams Toolkit CLI:
- Run command:
teamsapp auth login azure
. - Run command:
teamsapp provision --env dev
. - Run command:
teamsapp deploy --env dev
.
- Run command:
- From VS Code:
- Open the
Run and Debug Activity
Panel. SelectLaunch Remote (Codespaces)
from the launch configuration drop-down.
- Open the
- From Teams Toolkit CLI:
- Run command:
teamsapp preview --env dev
.
- Run command:
Date | Author | Comments |
---|---|---|
Apr 3, 2023 | Dooriya Li | Add notification sample for codespaces |
We really appreciate your feedback! If you encounter any issue or error, please report issues to us following the Supporting Guide. Meanwhile you can make recording of your journey with our product, they really make the product better. Thank you!