Linking TextBlock & Input.Text in a adaptive card - adaptive-cards

I have an adaptive card like below.
I want to shown what ever the user inputs in the Input.Text field in the TextBlock (instead of name). Is this even possible?
Note: I am building this with Bot Framework Composer.
{
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Text",
"placeholder": "Placeholder text",
"id": "name"
},
{
"type": "TextBlock",
"text": "Your name is <name>",
"wrap": true
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.3"
}

Related

Adaptive Card - Dynamically Generated Choices V1.5

I have the following old Adaptive card from a Playbook which I need to update to v1.5. But I stumble upon a problem with the choices which are dynamically generated from a logic app body. I have made the part of the code bold. There is a value that is not JSON proof so it should be required to convert it to JSON that way.
{
"type": "Input.ChoiceSet",
"choices": #{body('LogicApp_-_Get_tagged_playbooks')}, #THIS IS THE LINE THAT NEEDS TO BE CHANGED
"placeholder": "IP Playbooks",
"isMultiSelect": true,
"style": "expanded",
"id": "playbooks"
}
Full Code:
{
"msTeams": {
"width": "full"
},
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"size": "large",
"color": "accent",
"text": "**Microsoft Sentinel Alert - **#{triggerBody()?['object']?['properties']?['incidentNumber']} - #{triggerBody()?['object']?['properties']?['title']}",
"wrap": true
},
{
"type": "TextBlock",
"text": "Please Select the playbooks to run for the incident:",
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": "Available tagged Logic App playbooks",
"wrap": true,
"weight": "Bolder",
"color": "Accent"
},
{
"type": "Input.ChoiceSet",
"choices": #{body('LogicApp_-_Get_tagged_playbooks')},
"placeholder": "IP Playbooks",
"isMultiSelect": true,
"style": "expanded",
"id": "playbooks"
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
]
}
Could someone help me converting only that part of the choices to v1.5 so I can properly generate the choices myself? Or do I need to make my card legacy supported and drop it back to v1.2? I really want to use the card designer so I can make it easier.
Thanks in advance.

How to add Hyperlink to adaptive cards

I want to add hyperlink to adaptive card. I am using markdown features of Text block for it. I have below adaptive card. I referred to the below link https://learn.microsoft.com/en-us/adaptive-cards/authoring-cards/text-features#:~:text=localizing%20the%20text.-,Markdown%20(Commonmark%20subset),of%20the%20Commonmark%20Markdown%20syntax.
{
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.3",
"body": [
{
"type": "TextBlock",
"text": "This is some **bold** text"
},
{
"type": "TextBlock",
"text": "This is some _italic_ text"
},
{
"type": "TextBlock",
"text": "- Bullet \r- List \r",
"wrap": true
},
{
"type": "TextBlock",
"text": "1. Numbered\r2. List\r",
"wrap": true
},
{
"type": "TextBlock",
"text": "[Adaptiveards](https://adaptivecards.io)"
}
]
}
But in visualizer the hyperlink is not working. How to add a hyperlink to adaptive card?
may be the link is not proper try correcting your link also try using version 1.2 in adaptive cards

Bot framework user selected button text is not displaying in bot

I am developing Microsoft teams bot using ms bot framework. In that, i am using adaptive cards for displaying description and two buttons.
when user clicks the button, that time i need pass json data to backend. If I pass string data ("data": "ONE") on button action then I can able to read the arguments in backend and user clicked button text is coming in bot. Kindly see the code and output image below
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Hi, this is your Botzer personal assistant , how can I help you? Click Here ",
"weight": "bolder",
"isSubtle": false,
"wrap": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "ONE",
"data": "ONE"
},
{
"type": "Action.Submit",
"title": "TWO",
"data": "TWO"
}
]
}
}
But, when I send json data on button action ("data": { "id": "action2", "name": "two", "value": "TWO"}) that time i can read the data in backend. But, button text is not coming on the bot. Kindly see the code and output image below
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Choose the number",
"weight": "bolder",
"isSubtle": false,
"wrap": true
}
],
"actions": [
{
"type": "Action.Submit",
"title": "ONE",
"data": {
"id": "action1",
"name": "one",
"value": "ONE"}
},
{
"type": "Action.Submit",
"title": "TWO",
"data": {
"id": "action2",
"name": "two",
"value": "TWO"}
}
]
}
}
What you want is called a message back, which combines the functionality of string submit actions and object submit actions. Since you don't have any inputs in your Adaptive Card, you can replace it with a hero card and use a messageBack action directly. If you still want to use an Adaptive Card then you're in luck because Teams actually has special functionality that allows you to put a message back in an Adaptive Card. You can see how to do that in the "Adaptive Cards in Teams" section of the blog post Hessel linked to, or you can consult the documentation directly.

How to get a TextBlock Text via Action.Http?

I am trying to get TextBlock Text/Value ("Click Learn More to learn more about Actionable Messages!) in response when clicking Send Feedback.
I tried {{Heading.text}} and {{Heading.value}} with Heading being id of a field.
Adaptive Card
Getting value from Input.Text via {{feedbackText.value}} works just fine.
Sample:
{
"type": "AdaptiveCard",
"version": "1.0",
"hideOriginalBody": true,
"body": [
{
"type": "TextBlock",
"text": "Visit the Outlook Dev Portal",
"size": "Large"
},
{
"type": "TextBlock",
"text": "Click **Learn More** to learn more about Actionable Messages!",
"id": "Heading"
},
{
"type": "Input.Text",
"id": "feedbackText",
"placeholder": "Let us know what you think about Actionable Messages"
}
],
"actions": [
{
"type": "Action.Http",
"title": "Send Feedback",
"method": "POST",
"url": "https://webhook.site/.....",
"body": "{{feedbackText.value}}\n{{Heading.text}}\n{{Heading.value}}"
},
{
"type": "Action.OpenUrl",
"title": "Learn More",
"url": "https://learn.microsoft.com/outlook/actionable-messages"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"}
Thanks for help.
I had the same issue trying to send the value of the textblock in http body. I used the following workaround:
Created an Input.Number field
Set the Initially Visible property to false
When the Adaptive Card is compose, I used logic app/flow to populate the value of the field
The Action.Http was then set to the id.value value of the input box.

template forms in prismic

I'm new to prismic and trying to figure out if this is right tool for what I need. I need to create multiple form templates. I want prismic user to be able to build out the template, which will get loaded into gatsby where each field will get built out as components based on a title, type, action, name.
Title will be the title or label.
type will be the type of form element, ex: input, button, radio action,
if its a button the action it needs to do.
name the name for the form element.
Does prismic seem like a good candidate for this and does anyone know of any examples of how I might go about setting up the prismic end. Most of what Ive seen so far is full pages with just title and images. Not exactly forms.
In their repository I only see these options to create elements am I missing some important ones ?
Title
Rich Text
Image
Content Relationship
Link
Link to Media
Date
Timestamp
color
number
key text
Select
Embed
GeoPoint
Group
How would I go about creating form elements, Is there a way to create custom objects to export? Every time I try to add a new filed or a custom object to the json editor it says. Unrecognized, property it will be ignored.
I'd like to be able to use the group to group a bunch of form elements together even if they are just custom objects that I can pass custom properties to so when I load the group into React I can use the custom properties to build out my components ?? Can anyone set me straight here on if this is possible using prismic.
Thanks!
I can't say if Prismic is the best tool for this particular job, but i think you're overestimating what exactly you need in order to render a html form.
Consider the following custom type. It really only consists of titles, structured texts, a repeatable zone and a select. What you do with that data is completely up to you on the front end.
{
"Main": {
"uid": {
"type": "UID",
"config": {
"label": "Form UID",
"placeholder": "Form UID"
}
},
"form_title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "Form Title",
"placeholder": "Form Title"
}
},
"action_title": {
"type": "StructuredText",
"config": {
"single": "heading2",
"label": "action title",
"placeholder": "Submit form"
}
},
"form_action_description": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "form action description",
"placeholder": "form action description"
}
},
"success_message": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "success message",
"placeholder": "success message"
}
},
"error_message": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "error message",
"placeholder": "error message"
}
},
"submit_button_text": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "submit button text",
"placeholder": "submit"
}
},
"body": {
"type": "Slices",
"fieldset": "Slice zone",
"config": {
"choices": {
"test": {
"type": "Slice",
"fieldset": "Form Section",
"description": "Section of a form",
"icon": "vertical_align_center",
"display": "list",
"non-repeat": {
"form_section_title": {
"type": "StructuredText",
"config": {
"single": "heading1",
"label": "Form Section title",
"placeholder": "Form Section title"
}
},
"form_section_description": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "Form Section Description",
"placeholder": "Form Section Description"
}
}
},
"repeat": {
"label": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "label",
"placeholder": "label"
}
},
"type": {
"type": "Select",
"config": {
"options": [
"text",
"textarea",
"checkbox",
"radio",
"submit"
],
"default_value": "text",
"label": "type"
}
},
"name": {
"type": "StructuredText",
"config": {
"single": "paragraph",
"label": "name",
"placeholder": "name"
}
}
}
}
}
}
}
}
}