web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Adaptive Cards - Bot F...
Copilot Studio
Unanswered

Adaptive Cards - Bot Framework Handling

(1) ShareShare
ReportReport
Posted on by 41
Hi there, 

I'd appreciate some help. I've created a custom web app front end to communicate to a Copilot Studio agent via Direct Line. 

The back end handling has been created in Botframework C#.net

We've been able to get Adaptive Cards created in Copilot Studio to render correctly in the front end app, however we're struggling to be able to handle the submit action of the card and post it back to Copilot Studio. 

Has anyone been able to achieve this? If so, I'd greatly appreciate some help or guidance. 

Current code to handle the invoke of the card:
protected override async Task<InvokeResponse> OnInvokeActivityAsync(ITurnContext<IInvokeActivity> turnContext, CancellationToken cancellationToken)
{
   if (turnContext.Activity.Name == "adaptiveCard/action")
   {
       var submitData = turnContext.Activity.Value;  
       _logger.LogInformation("AdaptiveCard submit: {Data}", JsonConvert.SerializeObject(submitData));
       await RelayToCopilotStudioAsync(submitData, cancellationToken);
       return new InvokeResponse { Status = 200 };
   }
   return await base.OnInvokeActivityAsync(turnContext, cancellationToken);
}
Create activity to post back as a message:
 
var outgoing = Activity.CreateMessageActivity();

outgoing.ChannelId = "directline";

outgoing.Conversation = new ConversationAccount(id: _directLineConversationId);

outgoing.Value = submitData;

await _directLineClient
   .Conversations
   .PostActivityAsync(_directLineConversationId, (Activity)outgoing, cancellationToken);


 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,488 Super User 2025 Season 2 on at
     
    Can you please be specific in what your issue is. I will take a look at your code, but just want to be clear on the exact issue you are having.
     
    Cheers
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 270 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 181 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 93 Moderator

Last 30 days Overall leaderboard