How to pass a variable from a Power Apps canvas app into a Copilot Studio agent (Chatbot control)?

Palaparthi Krishna (US) 20 Reputation points
2026-07-08T17:26:53.7266667+00:00

Title: How to pass a variable from a Power Apps canvas app into a Copilot Studio agent (Chatbot control)?

Environment / setup:

  • Power Apps Canvas app with an embedded Chatbot control (Chatbot@0.1.12), connected to a Copilot Studio agent via EnvironmentId + SchemaName.
  • Copilot Studio agent has a global variable "selectedIndustry" with "External sources can set values" turned ON. The agent is published.
  • The app has an industry dropdown. When the user changes it, I want the agent to use that industry.

What I want:

When the dropdown changes, the agent should use the newly selected industry value in its topics/prompts (it drives which data the agent returns).

What I have tried:

  1. I set the Chatbot control's Endpoint property to my agent's token endpoint with a query string appended, e.g.: https://<...>.environment.api.powerplatform.com/copilotstudio/dataverse-backed/authenticated/bots/<botname>/conversations?api-version=2022-03-01-preview&selectedIndustry=Consumer%20Market Result: [describe what happened — e.g., "the agent did not pick up the value" / "Global.selectedIndustry stayed blank"].
  2. I removed the node in ConversationStart that was setting selectedIndustry to blank, so it no longer clears the external value.

Questions:

  1. Does the Chatbot control's Endpoint property support passing a Copilot Studio external/global variable via a query-string parameter? If yes, what is the exact expected URL format?
  2. If not, what is the supported way to pass a variable from a canvas app into an embedded Copilot Studio agent at conversation start?
  3. Is there a supported way to update the variable when the dropdown changes mid-session, or must the chat session be restarted?
  4. Given the Chatbot/Copilot canvas controls are being deprecated (Feb 2, 2026), what is the recommended replacement for embedding an agent in a canvas app AND passing context into it?

Thanks in advance.

Microsoft 365 and Office | Development | Other
0 comments No comments

Answer accepted by question author
Michelle-N 20,735 Reputation points Microsoft External Staff Moderator
2026-07-09T13:33:47.17+00:00

Hi @Palaparthi Krishna (US)

Based on the detailed configuration you shared, I understand that you are trying to pass a dynamic contextual variable (selectedIndustry) from a Power Apps canvas app dropdown into an embedded Copilot Studio agent. While you have correctly configured the agent's global variable to accept external values ("External sources can set values" turned ON) and removed any conflicting logic in ConversationStart, appending the variable as a query string parameter to the Chatbot control's Endpoint property is not causing the agent to pick up the value.

Here is the technical breakdown of why this approach is failing and the recommended steps to implement a supported, future-proof solution.

-I have not found Microsoft documentation indicating that appending query-string parameters to the Chatbot control Endpoint property is a supported mechanism for setting Copilot Studio global variables. While appending query strings directly to an embed URL works for standard custom website deployments, the native Power Apps Chatbot control acts as a restrictive wrapper around Web Chat. It handles authentication and endpoint routing internally, and it does not parse, forward, or expose URL query parameters into Copilot Studio global variables.

-For traditional custom web environments, Microsoft officially documents two ways to initialize external global variables:

const store = WebChat.createStore(
 {},
 ({ dispatch }) =>
 next =>
 action => {
 if (action.type === "DIRECT_LINE/CONNECT_FULFILLED") {
 dispatch({
 type: "WEB_CHAT/SEND_EVENT",
 payload: {
 name: "pvaSetContext",
 value: {
 selectedIndustry: "Consumer Market"
 }
 }
 });
 }
 return next(action);
 }
);

However, within a Canvas App utilizing the default Chatbot Control, you do not have access to JavaScript APIs, Web Chat middleware, or the underlying store to dispatch events directly. Therefore, you cannot natively pass variables at conversation start or update them mid-session using the built-in control.

-In a Power Apps canvas app, the built-in Chatbot control does not appear to expose the WebChat middleware/event layer needed to dynamically send context variables when a dropdown changes. Therefore, changing the dropdown mid-session is not something I would expect to work through the Endpoint property alone. The safer approach is either to restart the chat session with the new context, or move to a custom WebChat/PCF-based component where the canvas app can send a custom event to the Copilot Studio agent.

Also note that the Copilot/Copilot answer controls for canvas apps are being deprecated for new apps starting February 2, 2026. Microsoft recommends Microsoft 365 Copilot in canvas apps for natural-language app experiences. However, if the requirement is specifically to embed an existing Copilot Studio agent and pass custom app context into it, a PCF/WebChat implementation is currently the more suitable approach because it can send startup or runtime events into the agent

Please refer the following document: Add a Copilot control to a canvas app (preview)

I hope this information help.


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Oldest

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.