Extending Microsoft 365 Copilot using Messaging Extension based plugins

This article provides a comprehensive guide on how to extend bot-based message extensions as plugins for Copilot for Microsoft 365. By doing so, users can interact with third-party tools and services, enhancing their productivity. The article covers the concept of a plugin, prerequisites, and a step-by-step guide on creating a bot-based message extension.

Introduction

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.


Microsoft 365 Extensibilty Types

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.

Product & Services Copilot Plugin

Part of this article, we are going to build a Product & Servies Copilot Plugin. The Product and Services Copilot plugin uses a SharePoint list to provide the necessary data, removing the need to switch between applications. The plugin supports detailed searches based on various parameters such as Product Name, Product Description, Revenue Type, or Service Area. For example, searching for ‘Azure Cloud Migration’ can yield extensive details from the SharePoint list. The results are presented in a user-friendly table format.

Product & Service Copilot Plug

High level steps

  1. The user poses a question in natural language, such as “Show me all the products related to PowerBI.
  2. Copilot interprets the user’s intent and question.
  3. Copilot extracts the parameters from the user’s prompt, based on the commands specified in the manifest file.
  4. Copilot calls an Azure function, using the parameters it generated, to retrieve data from the Product & Service SharePoint list.
  5. Copilot transforms the API response to match the user’s prompt, for instance, presenting the data in a tabular format or as bullet points.
  6. Copilot automatically binds the Adaptive card with the response generated from the API.

Final output

Below is an example of how the Product & Service plugin operates: A user submits a query in natural language, and the Copilot responds by displaying results from the SharePoint list, seamlessly integrating the provided adaptive card.

Plugin usage

Steps to buid Messaging Extension based Copilot Plugin

Prerequisites

To begin building message extension plugins for Microsoft Copilot for Microsoft 365, please follow the link below to set up your development environment:

Set Up Your Development Environment for Building Message Extension Plugins for Microsoft Copilot for Microsoft 365

Note

1. Ensure that Copilot for Microsoft 365 is available for your organization

2. Only bot-based message extensions with search commands can be extended as plugins for Copilot for Microsoft 365

STEP 1 - Create bot-based message extension

Create bot-based message extension

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.
STEP 2 - Manifest file updates

Here are mandatory requirements for building message extension plugins for Copilot for Microsoft 365

App description

A well-crafted description succinctly outlines the app’s functionalities, enabling Copilot for Microsoft 365 to effectively identify and carry out search tasks. For instance, when a user combines the app name with an action, like “Find all the products related to Power BI,” Copilot for Microsoft 365 should promptly trigger the corresponding message extension plugin.

Screenshot shows the well-crafted app description.

1. Search 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. Search command descriptions must:

  • Focus on what and how the command searches (detailed list) in natural language.
  • Include verbs and synonyms, if applicable.
  • Focus on keywords that are likely to be used in the search function of your native apps.

"commands": [{
"id": "productSearch",
"description": "Search products and services using natural language and keywords for quick, intuitive results.",
"title": "Product search",
"type": "query",
"initialRun": false,
"fetchTask": false,
"context": [
"commandBox",
"compose",
"message"
]
}
]

2. Parameter Description

Every message extension command includes a parameters property, capable of supporting up to five parameters. Importantly, the first parameter is required to be visible in the message extension search bar. It is essential for each parameter to have a comprehensive description, encompassing acceptable values, enums, acronyms, and the expected output format.


"parameters": [{
"name": "productName",
"title": "Product Name",
"description": "Search for products by name",
"semanticDescription": "Search for products by name. This command allows you to find specific products within our catalogue by entering the product's name. You must use partial or full names to search. The command focuses on delivering results that closely match your search terms, providing a comprehensive list of products that align with your query. For example: show me all products with name as Azure Cloud Migration.",
"inputType": "text"
}
]

3. Compound utterances

In order to use compound utterances (multiple search terms) with Copilot for Microsoft 365, your message extension needs to support at least four parameters in its code. You can define these parameters in the app manifest file. Also, your web service needs to be updated to handle these extra parameters and potentially empty values from the user.

STEP 3 - Calling external web service

Calling external web service

References

Prerequisites for extending Microsoft 365 Copilot with a message extension bot

Build a bot-based messaging extension for Microsoft Teams

High-quality message extension for Microsoft Teams

Adding the Chef’s Kiss to Your Teams App Descriptions for Copilot

Author: Ejaz Hussain
Link: https://office365clinic.com/2024/06/21/extend-m365-copilot-msgext-plugin/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.