Muokkaa

Jaa


Build API plugins with a new API for Microsoft 365 Copilot

Important

API plugins are only supported as actions within declarative agents. They are not enabled in Microsoft 365 Copilot.

API plugins connect a REST API to Microsoft 365 Copilot. You can use the Teams Toolkit to quickly generate a plugin and a corresponding REST API that you can use as a starting point for your plugin development.

Create the plugin and API

  1. Open Visual Studio Code. If Teams Toolkit isn't already installed, see Install Teams Toolkit for installation instructions.

  2. Select the Teams Toolkit icon in the left-hand Activity Bar.

  3. Select Create a New App in the Teams Toolkit task pane.

    A screenshot of the Teams Toolkit interface

  4. Select Agent, then select Declarative Agent.

  5. Select Add plugin, then select Start with a new API.

  6. Select OAuth for the Authentication Type.

  7. Select your preferred programming language: JavaScript or TypeScript. This guide assumes TypeScript.

  8. Choose a location for the API plugin project.

  9. Enter Repairs Agent as a name for your plugin project.

Once you complete these steps, Teams Toolkit generates the required files for the plugin and opens a new Visual Studio Code window with the plugin project loaded. For details on the project, see the README.md file in the generated project's root directory.

Run the plugin

  1. In the Visual Studio Code window with the plugin project loaded, select the Teams Toolkit icon in the left-hand Activity Bar.

  2. In the Accounts pane, select Sign in to Microsoft 365. (If you're already signed in continue to the next step).

  3. Confirm that both Custom App Upload Enabled and Copilot Access Enabled display under your Microsoft 365 account. If they don't, check with your organization admin. See Requirements for plugin development for details.

  4. Select the Run and Debug icon in the left-hand Activity Bar.

  5. Select either Debug in Copilot (Edge) or Debug in Copilot (Chrome), then press F5 to start debugging.

Teams Toolkit builds the project, creates the plugin package, and sideloads it for your user account. Once that is done, a new browser window opens to the Microsoft Teams app.

Test the plugin

  1. In Microsoft Teams in your browser, select Copilot.

  2. Select Repairs Agentlocal in the Agents list on the right-hand side. If the list isn't available, select the Copilot chats and more icon in the top right corner.

  3. Send a message to Copilot about repairs. For example, try Which repairs are assigned to Karin?.

At this point, the plugin is running locally on your development machine without authentication. In order to add authentication, deploy the solution to Azure.

Deploy to Azure and enable authentication

  1. Select the Teams Toolkit icon in the left-hand Activity Bar.

  2. In the Lifecycle pane, select Provision.

  3. When asked for a resource group name, either accept the default or change it as desired and press Enter.

  4. Select a location for the resource group.

  5. Review the message in the dialog. If everything looks correct, select Provision to continue.

  6. Wait for the provisioning steps to complete, then select Deploy in the Lifecycle pane.

Once you complete these steps, the plugin is deployed as an Azure Function with authentication.

Test the plugin with authentication

  1. In Microsoft Teams in your browser, select Copilot.

  2. Select Repairs Agentdev in the Agents list on the right-hand side.

  3. Send a message to Copilot about repairs. For example, try Which repairs are assigned to Issac?.