A bot, chatbot, or conversational bot is an app that responds to simple commands sent in chat and replies in meaningful ways. Examples of bots in everyday use include: bots that notify about build failures, bots that provide information about the weather or bus schedules, or provide travel information. A bot interaction can be a quick question and answer, or it can be a complex conversation. Being a cloud application, a bot can provide valuable and secure access to cloud services and corporate resources.
This is a simple command bot that implements single sign-on feature to retrieve profile and photo for currently signed-in user using Bot Framework SDK, TeamsFx SDK and Microsoft Graph API, and the commands can be found as below:
command | response | sso command |
---|---|---|
helloworld | helloworld adaptive card message | false |
profile | user profile information from Microsoft Graph API | true |
photo | user photo image from Microsoft Graph API | true |
- How to use Teams Toolkit to create a Teams bot app.
- How to use Microsoft Graph to get User info and picture in Teams app.
- How to use TeamsFx SDK to implementing SSO for Teams bot.
- Node.js, supported versions: 18, 20, 22
- 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.
- Teams Toolkit Visual Studio Code Extension version 5.0.0 and higher or Teams Toolkit CLI
-
From VSCode
- Clone the repo to your local workspace or directly download the source code.
- Open the project in Visual Studio Code.
- Open Debug View (
Ctrl+Shift+D
) and select "Debug in Teams (Edge)" or "Debug in Teams (Chrome)" in dropdown list. - Press "F5" to open a browser window and then select your package to view contact exporter sample app.
-
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 forBOT_DOMAIN
andBOT_ENDPOINT
with your dev tunnel URL.BOT_DOMAIN=sample-id-3978.devtunnels.ms BOT_ENDPOINT=https://sample-id-3978.devtunnels.ms
- Run command:
teamsapp provision --env local
. - Run command:
teamsapp deploy --env local
. - Run command:
teamsapp preview --env local
.
If you don't have an Azure subscription, create a free account before you begin
-
From VSCode
- Sign in to Azure by clicking
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 in to Azure by clicking
-
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 VSCode:
- Once deployment is completed, you can preview the APP running in Azure. In Visual Studio Code, open
Run and Debug
and selectLaunch Remote (Edge)
orLaunch Remote (Chrome)
in the dropdown list and PressF5
or green arrow button to open a browser.
- Once deployment is completed, you can preview the APP running in Azure. In Visual Studio Code, open
- From Teams Toolkit CLI:
- Run command:
teamsapp preview --env dev
.
- Run command:
Date | Author | Comments |
---|---|---|
Sep 20, 2022 | rentu | update to support Teams Toolkit v4.0.0 |
Mar 17, 2023 | rentu | update to support Teams Toolkit v5.0.0 |
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!
SSO for command bot only supports personal chat. This bot may not work if you add it to a team or a group chat.