Skip to content

Support for Proactive Messaging from Skill to Copilot Studio via TurnContext Protocol  #159

@vrajroutu

Description

@vrajroutu

Description:
Currently, when building a Bot Framework skill (hosted as an Azure Web App) that is invoked by Copilot Studio, it is not possible to send proactive messages from the skill directly to the end user in Copilot Studio. The only supported pattern is to send messages during the current turn using context.sendActivity. If the skill needs to notify the user later (e.g., when an external event or agent response arrives), it must send an event to the parent bot (Copilot Studio), and only the parent bot can send the message to the user.


Current Limitation:

  • Proactive messaging from a skill to the end user is not supported.
  • The skill can only send an event activity to the parent bot, which must then relay the message to the user.
  • There is no protocol or API in TurnContext in the SDK to enable a skill to initiate a proactive message to the user in Copilot Studio.
  • Skills cannot initiate a new turn or conversation with the user after the original turn has ended.

Example Use Case:
A skill integrates with a live agent system (e.g., Genesys). When the user is escalated, the skill connects to a live agent. The agent may respond minutes later, but the skill cannot proactively notify the user in Copilot Studio. Instead, it must send an event to the parent bot, and the parent bot must handle and relay the message.


Sample Code Pattern (Current):

Skill Side (Current Pattern):

// When an agent message arrives asynchronously  
await context.sendActivity({  
    type: 'event',  
    name: 'genesysAgentMessage',  
    value: { text: agentText, conversationId: context.activity.conversation.id }  
    // ...other data  
});  

Copilot Studio (Parent Bot) Side:

// Pseudocode: Event trigger in Copilot Studio  
When event 'genesysAgentMessage' is received:  
    Send message to user: ${event.value.text}  

Limitation:
If the agent message arrives after the original turn has ended, the skill cannot initiate a new turn or send a message directly to the user. The only option is to send an event to the parent, which must be configured to handle and relay the message.


Desired Feature/Improvement:

  • Enable a protocol or API in the Agents-for-js SDK (or Bot Framework) that allows a skill to send proactive messages directly to the end user in Copilot Studio, using TurnContext or a similar mechanism.
  • This could be via a supported proactive messaging protocol, a callback registration, or an extension to the TurnContext that allows the skill to initiate a new turn with the user.
  • Ideally, the skill should be able to use a stored ConversationReference or similar context to send a message to the user at any time, similar to how proactive messaging works in root bots.

Sample Desired API (Hypothetical):

// Hypothetical API for proactive messaging from a skill  
const reference: ConversationReference = /* stored from initial turn */;  
await adapter.continueConversation(reference, async (proactiveContext) => {  
    await proactiveContext.sendActivity("Agent has replied: ...");  
});  

Note: Currently, this pattern only works for root bots, not for skills invoked by Copilot Studio.


Why This Is Important:

  • Many enterprise scenarios require skills to notify users asynchronously, such as when a live agent responds, a long-running process completes, or an external event occurs.
  • The current workaround (sending an event to the parent bot) adds complexity, requires additional configuration in Copilot Studio, and is not always reliable or transparent to skill developers.
  • Direct support for proactive messaging from skills would enable richer, more responsive, and more maintainable conversational experiences in Copilot Studio.
  • This would also align the skill experience with the root bot experience, where proactive messaging is a first-class feature.

Request:
Please consider adding support for proactive messaging from skills to Copilot Studio, or provide guidance and APIs in the SDK to enable this scenario in a secure and scalable way. If architectural limitations prevent this, please document the recommended patterns and any roadmap plans for improving this experience.


References:


Thank you for considering this feature request!


Metadata

Metadata

Assignees

No one assigned

    Labels

    DiscussionA great topic for discussion and collaboration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions