Compartilhar via


root.composeExtensions.commands object

Your message extension must declare one or more commands with a maximum of 10 commands. Each command appears in Microsoft Teams as a potential interaction from the UI-based entry point.

Each command item is an object with the following structure:

Properties that reference this object type:

Syntax

{
  "id": "{string}",
  "type": "query | action",
  "samplePrompts": [
    {
      "text": "{string}"
    }
  ],
  "apiResponseRenderingTemplateFile": "{string}",
  "context": [
    "compose | commandBox | message"
  ],
  "title": "{string}",
  "description": "{string}",
  "initialRun": {boolean},
  "fetchTask": {boolean},
  "parameters": [
    {
      "name": "{string}",
      "inputType": "text | textarea | number | date | time | toggle | choiceset",
      "isRequired": {boolean},
      "title": "{string}",
      "description": "{string}",
      "value": "{string}",
      "choices": [
        {
          choices object
        }
      ],
      "semanticDescription": "{string}"
    }
  ],
  "taskInfo": {
    "title": "{string}",
    "width": "{string}",
    "height": "{string}",
    "url": "{string}"
  },
  "semanticDescription": "{string}"
}
{
  "id": "{string}",
  "type": "query | action",
  "samplePrompts": [
    {
      "text": "{string}"
    }
  ],
  "apiResponseRenderingTemplateFile": "{string}",
  "context": [
    "compose | commandBox | message"
  ],
  "title": "{string}",
  "description": "{string}",
  "initialRun": {boolean},
  "fetchTask": {boolean},
  "semanticDescription": "{string}",
  "parameters": [
    {
      "name": "{string}",
      "inputType": "text | textarea | number | date | time | toggle | choiceset",
      "title": "{string}",
      "description": "{string}",
      "value": "{string}",
      "isRequired": {boolean},
      "semanticDescription": "{string}",
      "choices": [
        {
          choices object
        }
      ]
    }
  ],
  "taskInfo": {
    "title": "{string}",
    "width": "{string}",
    "height": "{string}",
    "url": "{string}"
  }
}

Properties

id

Id of the command.

Type
string

Required

Constraints
Maximum string length: 64.

Supported values

type

Type of the command. One of query or action.

Type
string

Required

Constraints

Supported values
Allowed values: query, action.

samplePrompts

Property used by Microsoft 365 Copilot to display prompts supported by the agent to the user. For Microsoft 365 Copilot scenarios, this property is required in order to pass app validation for store submission.

Type
Array of samplePrompts

Required

Constraints
Minimum array items: 1. Maximum array items: 5.

Supported values

apiResponseRenderingTemplateFile

A relative file path for api response rendering template file used to format the JSON response from developer’s API to Adaptive Card response.

Type
string

Required

Constraints
Maximum string length: 2048.

Supported values

context

Defines where the message extension can be invoked from. Any combination of compose, commandBox, message.

Type
Array of enum

Required

Constraints
Maximum array items: 3.

Supported values
Allowed values: compose, commandBox, message.

title

The user-friendly command name.

Type
string

Required

Constraints
Maximum string length: 32.

Supported values

description

The description that appears to users to indicate the purpose of this command.

Type
string

Required

Constraints
Maximum string length: 128.

Supported values

initialRun

A boolean value that indicates if the command should be run once initially with no parameter.

Type
boolean

Required

Constraints

Supported values
Default value: False.

fetchTask

A boolean value that indicates if it should fetch the dialog (referred as task module in TeamsJS v1.x) dynamically.

Type
boolean

Required

Constraints

Supported values
Default value: False.

parameters

The list of parameters the command takes.

Type
Array of parameters

Required

Constraints
Minimum array items: 1. Maximum array items: 5.

Supported values

taskInfo

Specifies the dialog to preload when using a message extension command.

Type
taskInfo

Required

Constraints

Supported values

semanticDescription

Semantic description of the command. This is typically meant for consumption by the large language model(LLM).

Type
string

Required

Constraints
Maximum string length: 5000.

Supported values

Examples

{
    "commands": [
        {
            "id": "exampleCmd1",
            "title": "Example Command",
            "type": "query",
            "context": [
                "compose",
                "commandBox"
            ],
            "description": "Command Description; e.g., Search on the web",
            "initialRun": true,
            "fetchTask": false,
            "parameters": [
                {
                    "name": "keyword",
                    "title": "Search keywords",
                    "inputType": "choiceset",
                    "description": "Enter the keywords to search for",
                    "value": "Initial value for the parameter",
                    "choices": [
                        {
                            "title": "Title of the choice",
                            "value": "Value of the choice"
                        }
                    ]
                }
            ]
        }
    ]
}