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.

Graph Connector Overview

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

Minimal path to awesome

Run the app locally

  1. Clone the repo to your local workspace or directly download the source code.
  2. Open the project in Visual Studio Code.
  3. Open Debug View (Ctrl+Shift+D) and select "Debug in Teams (Edge)" or "Debug in Teams (Chrome)" in dropdown list.
  4. Press "F5" to open a browser window and then select your package to view sample app.
  5. Find the Teams package in build\appPackage\appPackage.local.zip.
  6. 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

  1. Open the command palette and select Teams: Provision. You will be asked to select Azure resource group to provision the sample.
  2. Once provision is completed, open the command palette and select Teams: Deploy.

Preview the app in Teams

  1. Once deployment is completed, you can preview the APP running in Azure. In Visual Studio Code, open Run and Debug and select Launch Remote (Edge) or Launch Remote (Chrome) in the dropdown list and Press F5 or green arrow button to open a browser.
  2. Use Teams Toolkit to publish your Teams app to your organization.

Usage of this sample

  1. Navigate to 'Graph Connector' section of the Teams app in Teams Admin Center, and click 'Grant permissions'.

    Grant permissions

  2. Wait for connection status to be ready.

    Note: It may take about several minutes.

    Connection ready

  3. In Teams, type query <query string> in bot conversation to query data from Graph connector.

    Query

  4. 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!