简体   繁体   中英

is it possible to add action.open url inside the body array in adaptive card?

In my bot application i need to display a action.open Url button in-between the text.I need to Add Action.Open url inside the body tag of the json at the end of date as shown in the image and need to click the url link to do some actions.

Adaptive Card Design Image

is it possible to add the button in-between text or at the top of text inside the body tag.?

 { "type": "AdaptiveCard", "body": [ { "type": "TextBlock", "size": "Medium", "weight": "Bolder", "color": "Warning", "text": "Company Name" }, { "type": "TextBlock", "text": "Meeting Details", "wrap": true }, { "type": "FactSet", "facts": [ { "title": "Description", "value": "xxx" }, { "title": "Key Note Speaker", "value": "yyy" }, { "title": "Date :", "value": "03/25/2019 12:30:00 PM" } ] }, { "type": "TextBlock", "horizontalAlignment": "Center", "size": "ExtraLarge", "weight": "Bolder", "color": "Accent", "text": "**************" }, { "type": "TextBlock", "text": "Meeting Details", "wrap": true }, { "type": "FactSet", "facts": [ { "title": "Description", "value": "xxx" }, { "title": "Key Note Speaker", "value": "yyy" }, { "title": "Date :", "value": "03/25/2019 12:30:00 PM" } ] }, { "type": "TextBlock", "horizontalAlignment": "Center", "size": "ExtraLarge", "weight": "Bolder", "color": "Accent", "text": "**************" } ], "actions": [ { "type": "Action.OpenUrl", "title": "Add to Calender", "url": "http://adaptivecards.io" }, { "type": "Action.OpenUrl", "title": " Click here to add more Info ", "url": "http://adaptivecards.io" } ], "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.0" } 

Unfortunately, the default location for buttons in AdaptiveCards is at the bottom of the card, and you are unable to change that. However, you can add an image styled how ever you'd like to the card with a selectAction attribute that will submit data associated with the action when the user clicks the image. For more details see the example AdaptiveCard JSON below and the AdaptiveCard Documentation for Images and Select Actions .

Screenshot

在此处输入图片说明

JSON

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Large",
            "weight": "Bolder",
            "color": "Accent",
            "text": "Company Name"
        },
        {
            "type": "TextBlock",
            "separator": true,
            "size": "Medium",
            "text": "Meeting Details"
        },
        {
            "type": "TextBlock",
            "text": "Description:"
        },
        {
            "type": "TextBlock",
            "text": "Keynote Speaker:"
        },
        {
            "type": "TextBlock",
            "text": "Date:"
        },
        {
            "type": "Image",
            "selectAction": {
                "type": "Action.Submit",
                "data": "Meeting 1"
            },
            "url": "C:\\Users\\v-thdurn\\Developer\\Node\\Azure\\thdurn-all-channels-src\\resources\\button.png"
        },
        {
            "type": "TextBlock",
            "separator": true,
            "size": "Medium",
            "text": "Meeting Details"
        },
        {
            "type": "TextBlock",
            "text": "Description:"
        },
        {
            "type": "TextBlock",
            "text": "Keynote Speaker:"
        },
        {
            "type": "TextBlock",
            "text": "Date:"
        },
        {
            "type": "Image",
            "selectAction": {
                "type": "Action.Submit",
                "data": "Meeting 2"
            },
            "url": "C:\\Users\\v-thdurn\\Developer\\Node\\Azure\\thdurn-all-channels-src\\resources\\button.png"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
}

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM