Graph Connector Bot
This sample app showcases how to build a Teams command bot that queries custom data ingested into Microsoft Graph using Graph connector.
This sample illustrates
- How to handle webhook notification when Graph connector is turned on or off in Teams Admin Center.
- How to use Microsoft Graph API to integrate with Microsoft Graph connector.
- How to use TeamsFx SDK to build bot to query data from Microsoft Graph connector.
Prerequisite to use this sample
- Node.js, supported versions: 16, 18
- An Azure subscription
- An Microsoft 365 account with admin permission. If you do not have M365 account, apply one from M365 developer program
- Teams Toolkit Visual Studio Code Extension version 5.0.0 and higher or TeamsFx CLI
Minimal path to awesome
Run the app locally
- 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 sample app.
- Find the Teams package in
build\appPackage\appPackage.local.zip
. - Navigate to Teams Admin Center, and upload the Teams package.
Note: If you are testing in a new debug session again, you need to delete the existing Teams app in Teams Admin Center and upload a new one, since the tunnel endpoint will change when you start a new debug session.
Deploy the app to Azure
If you don't have an Azure subscription, create a free account before you begin
- Open the command palette and select
Teams: Provision
. You will be asked to select Azure resource group to provision the sample. - Once provision is completed, open the command palette and select
Teams: Deploy
.
Preview the app in Teams
- 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. - Use Teams Toolkit to publish your Teams app to your organization.
Usage of this sample
Navigate to 'Graph Connector' section of the Teams app in Teams Admin Center, and click 'Grant permissions'.
Wait for connection status to be ready.
Note: It may take about several minutes.
In Teams, type
query <query string>
in bot conversation to query data from Graph connector.In 'Graph Connector' section of Teams Admin Center, you could toggle the 'Connection status' to turn off Graph connector, then the connection will be deleted.
Version History
Date | Author | Comments |
---|---|---|
Sep 8, 2022 | junhan | update to support Teams Toolkit v4.0.0 |
Mar 21, 2023 | junhan | update to support Teams Toolkit v5.0.0 |
Feedback
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!