TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ali Almahdi
NA
9
2.8k
How can I retrieve and capture Adaptive card action.submit
Apr 8 2019 2:24 AM
I have created a LUIS Template Bot Application (Version 3) and I need to capture the output of an Adaptive Card drop down list. I am currently able to create and render the drop down list but facing difficulty capturing the result once the button is clicked. Can you please give me a solution or give link to appropriate tutorial for version 3 as resources for this issue is mostly for version 4.
public
Attachment PolicyAdaptiveCard() {
var card =
new
AdaptiveCard();
var choices =
new
List < AdaptiveChoice > ();
choices.Add(
new
AdaptiveChoice() {
Title =
"Category 1"
, Value =
"c1"
});
choices.Add(
new
AdaptiveChoice() {
Title =
"Category 2"
, Value =
"c2"
});
var choiceSet =
new
AdaptiveChoiceSetInput() {
IsMultiSelect =
false
, Choices = choices, Style = AdaptiveChoiceInputStyle.Compact, Id =
"Category"
};
card.Body.Add(choiceSet);
card.Actions.Add(
new
AdaptiveSubmitAction() {
Title =
"Select Category"
, Data = Newtonsoft.Json.Linq.JObject.FromObject(
new
{
button =
"select"
})
});
Attachment attachment =
new
Attachment() {
ContentType = AdaptiveCard.ContentType, Content = card, Name = $
"Card"
};
return
attachment;
}
This is JSON output that I am capturing in Bot Emmulator
{
"channelData"
:{
"clientActivityID"
:
"15547009411880.yfus2yy2mao"
,
"postBack"
:
true
},
"channelId"
:
"emulator"
,
"conversation"
:{
"id"
:
"3f50f7c1-59be-11e9-98bd-17dcaa70e8d3|livechat"
},
"from"
:{
"id"
:
"r_tckd4zoa8h"
,
"name"
:
"User"
,
"role"
:
"user"
},
"id"
:
"48d27080-59be-11e9-93ff-a77a4eb2d000"
,
"localTimestamp"
:
"2019-04-08T08:22:21+03:00"
,
"locale"
:
"en-US"
,
"recipient"
:{
"id"
:
"97e06f60-496a-11e9-9541-3d37a55e03cc"
,
"name"
:
"Bot"
,
"role"
:
"bot"
},
"serviceUrl"
:
"http://localhost:56373"
,
"showInInspector"
:
true
,
"timestamp"
:
"2019-04-08T05:22:21.192Z"
,
"type"
:
"message"
,
"value"
:{
"Category"
:
"c1"
,
"button"
:
"select"
}
}
How can I read the value and output "c1" in the next method ? This is the code that I am following. Can you please give me the method I can use to capture the category value
var reply = context.MakeMessage();
var activityValue = context.Activity.AsMessageActivity().Value
as
Newtonsoft.Json.Linq.JObject;
if
(activityValue !=
null
) {
var categorySelection = activityValue.ToObject < CategorySelection > ();
var category = categorySelection.Category;
await context.PostAsync(reply);
}
Reply
Answers (
2
)
Azure Site Recovery
How to generate report in angular 6 on client side