Create an API-based message extension

You can create an API-based message extension using Developer Portal for Teams and Teams Toolkit for Visual Studio Code, command line interface (CLI), or Visual Studio.

To create an API-based message extension using Developer Portal for Teams, follow these steps:

  1. Go to Teams Developer Portal.

  2. Go to Apps.

  3. Select + New apps.

  4. Enter a name of the app and select the Manifest version as Latest prerelease (devPreview).

  5. Select Add.

    Screenshot shows the app name and the manifest version selected as Latest prerelease (devPreview) in Developer Portal.

  6. In the left pane, under Configure, update the following Basic information:

    1. Full name
    2. Short description
    3. Long description
    4. Developer or company name
    5. Website (must be a valid HTTPS URL)
    6. Privacy policy
    7. Terms of use
  7. Select Save.

  8. Select App features.

  9. Select Messaging extension.

    Screenshot shows the message extension option in Teams Developer Portal.

  10. Under Message extension type, select API.

    1. If you get a disclaimer, which reads Bot message extension is already in use by users. Would you like to change message extension type to API?. Select Yes, change.
  11. Under OpenAPI spec, select Upload now.

    Screenshot shows the Upload now option in Teams Developer Portal.

  12. Select the OpenAPI Description document in the JSON or YAML format and select Open.

  13. Select Save. A pop-up appears with the message API spec saved successfully.

  14. Select Got it.

    Screenshot shows an example of the API spec saved successfully message and Got it button.

Add commands

Note

Message extensions built from an API only support a single parameter.

You can add commands and parameters to your message extension, to add commands:

  1. Under Message extension type, select Add.

    Screenshot shows the add option to add commands in Teams Developer Portal.

    An Add command pop-up appears with a list of all the available APIs from the OpenAPI Description document.

  2. Select an API from the list and select Next.

    Screenshot shows the list of APIs from the OpenAPI Description Document in the Add a command pop-up window.

    A Command details appears.

  3. Under Command details, go to Adaptive card template and select Upload now.

    Screenshot shows the Upload now option to add the Adaptive Card template in for the command.

    Note

    If you have more than one API, ensure that you upload the Adaptive card template for each API.

  4. Select the Adaptive Card template file in JSON format and select Open.

    The following attributes are updated automatically from the Adaptive Card template:

    • Command Type
    • Command ID
    • Command title
    • Parameter name
    • Parameter description

    Screenshot shows the fields available in the command details page.

  5. Under Details, update the Command description.

    1. If you want to launch a command using a trigger in Microsoft 365 Copilot, turn on the Automatically run the command when a user opens the extension toggle.
  6. Select Add. The command is added successfully.

  7. Select Save.

An API-based message extension is created.

Screenshot shows the plugin for Microsoft 365 Copilot created in the app features page in Teams Developer Portal.

To test your API-based message extension created in the Developer Portal for Teams, you can use the following methods:

  • Preview in Teams: In Developer Portal, open your message extension and select Preview in Teams in the upper-right corner. You're redirected to Teams, where you can add the app to Teams to preview the app.

  • Download app package: On the message extension page, select App package from the left pane and then, in the upper-left corner of the window, select Download app package. The app package is downloaded to your local machine in a .zip file. You can upload the app package to teams and test the message extension.

Step-by-step guides

To build an API-based message extension, follow these step-by-step guides: