Build notification bot
The notification bot proactively sends messages in a Teams channel, group chat, or personal chat. You can trigger the notification bot with an HTTP request, such as cards or texts.
In this tutorial, you'll learn about a notification bot app in one of the following ways.
- GitHub Codespaces: The codespace instance allows you to experience a Teams app instantaneously. It opens Visual Studio Code (VS Code) where the Teams Toolkit extension, the app source code, and all the dependencies are pre-packaged for you.
- Step-by-step guide: Allows you to set up your development environment and build a Teams app from the start.
Before you create your codespace, ensure that you have the following prerequisites:
- A GitHub account to create your codespace instance
- A Microsoft 365 account with sideloading permission
- A Microsoft 365 tenant
To create a Teams notification bot with GitHub Codespaces, follow these steps:
Select the following button to open GitHub Codespaces.
You might be asked to sign in to GitHub account if you haven't already.
Select Create new codespace.
The Setting up your codespace page appears.
Teams Toolkit prepares the notification bot project for you and opens it in VS Code in the browser. The Teams Toolkit icon appears in the activity bar of VS Code.
Select Sign in to your Microsoft 365 and Sign in to Azure to sign in with your Microsoft 365 account.
When you build your app, GitHub Codespaces loads it to the Teams client in a new tab. If your browser blocks pop-up tabs or windows, you'll need to allow pop-ups for your app to open.
Select Preview your Teams App (F5) to build your notification bot.
GitHub Codespaces builds your notification bot app, loads it to Teams client, and opens it in a separate browser tab.
Once the app dialog appears, select Add to install your notification bot in Teams.
Open a new terminal in your codespace and run the following command to trigger an event for sending a notification to your bot:
curl -X POST http://localhost:3978/api/notification
In real time, events are triggered by an external source, such as a third-party API that cause the notification bot to send the user a notification. To emulate an event trigger, you can send an event manually via curl commands on terminal.
The notification bot app sends a notification as an Adaptive Card to your Teams client:
You've now successfully created the notification bot and loaded it in the Teams client.
If you want to build a message extension, select the following:
If you want to build basic tab app, select the following: