1
votes

I am using Microsoft bot framework, i have requirement to open URL after clicking button. I have achieve that by using Adaptive card. URL is opening in button click. I need to implement confirmation option, when user click on button, pop should come and ask for confirmation of opening the URL. I tried that it is working in emulator but in web it not working. it simply opens the URL without asking the confirmation.

My bot will be used in web.

I have refer https://adaptivecards.io/samples/

below is my code for adaptive card

"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "type": "AdaptiveCard",
        "version": "1.0",

        "actions": [
            {
                "type": "Action.OpenUrl",
                "title": "Action.OpenUrl",
                "url": "https://adaptivecards.io"
            }
        ]

enter image description here

Thanks Sanjeev Gautam

1

1 Answers

3
votes

This happens only in Local Emulator,

For this to happen in browser you need to handle it differently, You can use the same adaptive cards to get this happen, I have mentioned one sample below for your reference

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.0",
    "body": [
        {
            "type": "TextBlock",
            "text": "This is Vinay Jayaram Helping you to open a URL"
        }
    ],
    "actions": [
        {
            "type": "Action.ShowCard",
            "title": "https://adaptivecards.io",
            "card": {
                "type": "AdaptiveCard",
                "body": [
                    {
                        "type": "TextBlock",
                        "text": "Are You sure you want to open this link?"
                    }
                ],
                 "actions": [

            {
                "type": "Action.OpenUrl",
                "title": "YES",
                "url": "https://adaptivecards.io"
            }
        ],
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
            }
        }
    ]
}

Looks like this:

enter image description here

Onclick:

enter image description here

Reference: https://adaptivecards.io/explorer/Action.ShowCard.html

Let me know if this works fine for you. Happy Coding