Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
- This is a preview feature.
- Preview features aren’t meant for production use and might have restricted functionality. These features are subject to supplemental terms of use, and are available before an official release so that customers can get early access and provide feedback.
Executes a Microsoft Copilot Studio topic based on the trigger queries registered in the topic. Returns an array of type MCSResponse.
Available for
Model-driven apps
Syntax
context.copilot.executeEvent(promptText).then(successCallback, errorCallback);
Parameters
Parameter Name | Type | Required | Description |
---|---|---|---|
promptText |
string | Yes | The text that is registered as a trigger query in the MCS topic. |
successCallback |
Function | Yes | A function to call when the operation succeeds. |
errorCallback |
Function | Yes | A function to call when the operation fails. |
Return Value
Type: Promise<
MCSResponse>
See Promise and MCSResponse
Example
In Microsoft Copilot Studio, when a topic is triggered by queries like "hello" or "hi." When executePrompt
runs with matching promptText
, it activates the topic and returns a Message activity with the response text.
const response = await context.copilot.executePrompt("hello");
Response
[
{
"type": "message",
"timestamp": "2025-02-05T16:46:07.7799759+00:00",
"replyToId": "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb",
"attachments": [],
"textFormat": "markdown",
"text": "Hello, how can I help you today?",
"speak": "Hello, <break strength=\"medium\" /> how can I help?"
}
]
Related articles
Copilot
executeEvent
Power Apps component framework API reference
Power Apps component framework overview