I´m trying to find a way to let a user retrieve, edit and post multiple data in a table. Like this:
A user asks for some entity, for e.g. Person
The MS bot returns a table with all the attributes for that Person (for ex: age, name, address etc)
The user can edit the data directly in the table, press send and the data
stored in the DB.
Is there any support for this? Any guidance is appreciated.
You can use Adaptive Cards to provide the user with a 'Form' to fill out. Not all channels support Adaptive Cards, but the list of supported channels is growing. For more information, please see: https://adaptivecards.io/ and howto: send-an-adaptive-card
Here is an example from MS Teams:
The card can be created using the Adaptive Cards library, or loaded from .json file like this:
string cardPath = Path.Combine(_hostingEnvironment.WebRootPath, "testcard.json");
string cardText = File.ReadAllText(cardPath);
var card = AdaptiveCards.AdaptiveCard.FromJson(cardText);
var reply = turnContext.Activity.CreateReply("card");
reply.Attachments.Add(new Attachment()
{
Content = card.Card,
ContentType = AdaptiveCards.AdaptiveCard.ContentType
});
await turnContext.SendActivityAsync(reply);
Note: when the user submits the card, the activity.Value will contain a .json string of values:
Example Card .json:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Tell us about yourself...",
"weight": "bolder",
"size": "large"
},
{
"type": "TextBlock",
"text": "We just need a few more details to get you booked for the trip of a lifetime!",
"isSubtle": true,
"wrap": true
},
{
"type": "TextBlock",
"text": "Don't worry, we'll never share or sell your information.",
"isSubtle": true,
"wrap": true,
"size": "small"
},
{
"type": "TextBlock",
"text": "Your name",
"wrap": true
},
{
"type": "Input.Text",
"id": "firstlast",
"placeholder": "Last, First",
"style": "text",
"separataion": "none"
},
{
"type": "TextBlock",
"text": "Your email",
"wrap": true
},
{
"type": "Input.Text",
"id": "email",
"placeholder": "youremail#example.com",
"style": "email",
"separataion": "none"
},
{
"type": "TextBlock",
"text": "Phone Number"
},
{
"type": "Input.Text",
"id": "phone",
"placeholder": "xxx.xxx.xxxx",
"style": "tel"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Send",
"data": { "personalInfo": "" }
}
]
}
Related
I am using an adaptive card to prompt the drop-down list to the user. Once submit action is performed I want the selected user option to be displayed to the user in Teams. I am using a bot framework.
I probably want to display the userinput id which captures the data.
"items": [{
"type": "Input.ChoiceSet",
"style": "compact",
"id": "UserInput",
"choices" : categories
},
{
"type": "ActionSet",
"actions": [{
"type": "Action.Submit",
"title": "Confirm",
"data": {
"msteams": {
"type": "imBack",
"value": ?????
}
}
}
]
I'm trying to grab the input text from a Teams Adaptive Card and use that in my logic app. Currently the response is not recorded in the logic app.
Any help would be appreciated!
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"actions": [
{
"id": "Yes",
"title": "Create Ticket",
"type": "Action.Submit"
},
{
"style": "positive",
"title": "View in SentinelOne Portal",
"type": "Action.OpenUrl",
"url": "#{replace(outputs('URL'), '[', '')}"
}
],
"body": [
{
"size": "Large",
"text": "#{triggerBody()?['subject']}",
"type": "TextBlock",
"wrap": true
},
{
"items": [
{
"text": "#{outputs('Compose_9')}",
"type": "TextBlock",
"wrap": true
}
],
"type": "Container"
},
{
"type": "TextBlock",
"text": "Ticket Info",
"wrap": true
}
],
"msteams": {
"width": "Full"
},
"type": "AdaptiveCard",
"version": "1.5",
"verticalContentAlignment": "Top"
}
Thanks,
Jeremy
Managed to resolve this myself, the output of 'Post adaptive card and wait for response' doesn't give any output options so you have to format it yourself
Parse json, enter input in the expression field: #Outputs('adaptivecardname')?[body]
There are two similar actions to send an Adaptive Card in Power Automated - "Post adaptive card in a chat or a channel" and also "Post adaptive card and wait for a response". You need to use the 2nd one if you expect a response from the card.
Two compose extension commands are defined in the manifest. These trigger a request to bot framework, which responds with an adaptive card.
When the adaptive card is displayed, it's rendered correctly except the button is missing. If I send the exact same adaptive card as a chat activity, it displays correctly.
handleTeamsMessagingExtensionFetchTask Code
// enableInboundCard = below json
const card = this.renderAdaptiveCard(enableInboundCard, { channel })
return {
task: {
type: 'continue',
value: {
card,
height: 500,
title: 'Enable Inbound',
width: 600
}
}
};
Command (in manifest).
{
"id": "enableInbound",
"context": [
"compose"
],
"description": "Enable inbound SMS to channel",
"title": "Enable Inbound",
"type": "action",
"fetchTask": true,
"parameters": [
{
"name": "test",
"title": "test",
"inputType": "text",
"value": "test"
}
]
}
Adaptive Card
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"wrap": true,
"style": "heading",
"text": "Enable Inbound SMS"
},
{
"type": "TextBlock",
"text": "A wholeeeeeeee bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch of txt",
"wrap": true
},
{
"type": "FactSet",
"facts": [
{
"title": "Current Channel",
"value": "${channel}"
}
]
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Execute",
"title": "Enable Inbound SMS",
"verb": "enable_inbound",
"fallback": "Action.Submit"
}
]
}
]
}
I am creating a password reset flow and wondering if we an adaptive card which includes 'new password' and 'confirm password' n a single card. Something like below
I know I could use 2 adaptive card with Input.text and style = password to achieve this. Wondering if we have anythign else.
You can use multiple input test box in a single adaptive card. to add New password and conform password you can use two input boxes in the single adaptive card.
Example:
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.3",
"body": [
{
"type": "TextBlock",
"text": "Please enter your new password below:",
"wrap": true,
"weight": "Bolder",
"size": "Medium"
},
{
"type": "TextBlock",
"text": "New Password*",
"wrap": true
},
{
"type": "Input.Text",
"placeholder": "***************"
},
{
"type": "TextBlock",
"text": "Repeat New Password*",
"wrap": true
},
{
"type": "Input.Text",
"placeholder": "***************"
}
]
}
By default when we use adaptive cards in a waterfall dialog, the bot records the selected action and process the next waterfall step -
how it actually looks
Instead can we display the selected option in the adaptive card as if the user typed in the option like -
What I want it to look like
I have a requirement where we want to display it as if the user typed it in and not like the bot says "you selectd X option".
You can do this by using the 'data' property in your Adaptive Card.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"spacing": "medium",
"size": "small",
"weight": "bolder",
"text": "",
"wrap": true,
"maxLines": 0
},
{
"type": "Container"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Policy",
"data": "Policy"
},
{
"type": "Action.Submit",
"title": "Scheduled",
"data": "Scheduled"
}
]
}