Extend bot-based message extension as plugin for Copilot for Microsoft 365

Note

  • Ensure that Copilot for Microsoft 365 is available for your organization. You have two ways to get a developer environment for Copilot:
  • Bot-based search message extension plugin is available in public developer preview.
  • Only bot-based message extensions with search commands can be extended as plugins for Copilot for Microsoft 365.

Microsoft Copilot for Microsoft 365, powered by an advanced processing and orchestration engine, integrates Microsoft 365 apps, Microsoft Graph, and large language models (LLMs) to transform your words into a potent productivity tool. Although Copilot for Microsoft 365 can utilize apps and data within the Microsoft 365 ecosystem, many users rely on various external tools and services for work management and collaboration. By extending your message extension as a plugin in Copilot for Microsoft 365, you can enable users to interact with third-party tools and services, therefore empowering them to achieve more with Copilot for Microsoft 365. You can achieve this extension by developing a plugin or connecting to an external data source.

Graphic shows the user interaction flow between the user, Microsoft Teams and M365 Chat.

See the video to learn more about extending Copilot for Microsoft 365 using Teams message extensions:

What is a plugin?

A plugin allows Copilot for Microsoft 365 to interact directly with third-party data, apps, and services, enhance its capabilities, and broaden its range of capabilities. Plugins allow Copilot for Microsoft 365 to:

  • Fetch real-time information, such as the latest news coverage on a product launch.
  • Retrieve knowledge-based information, such as a team’s design files in Figma.
  • Perform actions on behalf of the user, such as creating a Contoso ticket.

Descriptions enhance the usability and effectiveness of a message extension plugin. The follwoing description offer a clear and concise summary of the app’s features:

  • App description: App description helps improve your app discoverability in the Teams Store.
  • Command description: Command description maps user intent and utterance to search command inside a plugin and must be built based on the analysis of the user intent and keywords.
  • Parameter description: Parameter description explains the requirements of the system in a natural language with output format.
  • Semantic description: Semantic description helps Copilot for Micrososft 365 generate content by providing a conceptual understanding of the plugin's capabilities and scenarios where it can help achieve user goals and match user’s intent with the plugin's capabilities.

For more information, see define descriptions.

All bot-based search message extensions are eligible for plugin support, subject to validation to ensure the plugin meets quality, security, privacy, and usefulness expectations. You can create a bot-based search message extension using Teams Toolkit for Visual Studio Code, Visual Studio, Teams Toolkit command line interface (CLI), or Developer Portal for Teams and extend the message extension to function as a plugin in Copilot for Microsoft 365.

Prerequisites

Before you get started, ensure that you're familiar with the following standards and guidelines for building message extension plugins for Copilot for Microsoft 365:

Create bot-based message extension

Important

Plugins for Microsoft Copilot for Microsoft 365 are in preview and only work in Microsoft 365 Chat in Microsoft Teams.

Let's create a bot-based search message extension that can search npm registries in Teams and Copilot and share results through the compose message area of the Microsoft Teams client.

Before you get started, ensure that you install the following tools to build and deploy your message extension:

  • Install the latest Teams Toolkit prerelease version.
  • Ensure that the Develop Copilot Plugin feature flag is enabled. To enable the feature flag, follow these steps:
    1. Open Visual Studio Code.
    2. Go to Manage > Settings.
    3. Enter Teams Toolkit in the Search settings search box.
    4. Under Extensions, select the Fx-extension: Develop Copilot Plugin checkbox.

To create a bot-based search message extension plugin using Visual Studio Code, follow these steps:

  1. Open Visual Studio Code.

  2. From the left pane, select Teams Toolkit.

  3. Select Create a New App.

  4. Select Message Extension.

  5. Select Custom Search Results.

  6. Select Start with a Bot.

    Screenshot shows the Start with a Bot option to create a bot-based message extension in Visual Studio Code.

  7. Select a programming language.

  8. Select Default folder.

  9. Enter the name of your app and select Enter. Teams Toolkit scaffolds your app and creates a message extension.

To run your message extension in Teams, follow these steps:

  1. From the left pane, select Teams Toolkit.

  2. Under ACCOUNTS, perform the following steps:

    1. Select Sign in to Microsoft 365 and enter your Microsoft 365 credentials.

    2. Select Sign in to Azure and enter your Azure credentials.

      Screenshot shows the Sign in to Microsoft 365 and Azure option under ACCOUNTS in Teams Toolkit for Visual Studio Code.

  3. From the left pane, select Run and Debug (Ctrl+Shift+D).

  4. Select Debug in Teams (Edge) or Debug in Teams (Chrome). Teams Toolkit launches your app in Teams using a web browser.

  5. Select Add. The app is installed on Teams.

  6. Go to a chat and select Actions and apps.

  7. From the message extension fly-out menu, enter the name of your message extension in the search box.

  8. Select your message extension and enter your search query.

  9. Select a product from the list. Teams unfurls the product as an Adaptive Card in the message compose area.

  10. Select Send.

Trigger message extension in M365 Chat

To trigger the message extension as plugin in M365 Chat, follow these steps:

  1. Select Apps.

  2. Search for M365 Chat and open the M365 Chat app.

  3. Select Plugins.

  4. From the list of plugins, turn on the toggle for your message extension.

    Screenshot shows the Plugin option, list of plugins, and the toggle enabled for bot-based-ME-test-local plugin.

  5. From the message compose area, send a message to M365 Chat to search for npm package information in Teams and Copilot. For example, find the npm package info on teamsfx-react in npm-searchlocal.

    Screenshot shows the plugin prompt and the response from M365 Chat.

Note

This prompt might not always make M365 Chat include a response from your message extension. If it happens, try some other prompts or leave feedback to us by downvoting the M365 Chat response and leave a message.

For more on testing your plugin in Copilot for Microsoft 365 chat, see Debugging plugin selection.

Step-by-step guide

Follow the step-by-step guide to build a bot-based search message extension plugin for M365 Chat.

See also