【问题标题】:Action.OpenUrl in Adaptive card, Confirmation for opening the URl自适应卡片中的 Action.OpenUrl,打开 URl 的确认
【发布时间】:2020-03-16 03:50:49
【问题描述】:

我正在使用 Microsoft bot 框架,我需要在单击按钮后打开 URL。我通过使用自适应卡实现了这一点。 URL 在按钮点击中打开。 我需要实现确认选项,当用户单击按钮时,弹出窗口应该会要求确认打开 URL。 我试过它在模拟器中工作,但在网络上它不起作用。它只是打开 URL 而不要求确认。

我的机器人将用于网络。

我已经推荐https://adaptivecards.io/samples/

下面是我的自适应卡代码

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

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

谢谢 桑吉夫·高塔姆

【问题讨论】:

    标签: botframework chat bots chatbot azure-bot-service


    【解决方案1】:

    这只发生在本地模拟器中,

    要在浏览器中发生这种情况,您需要以不同的方式处理它,您可以使用相同的自适应卡来实现这种情况,我在下面提到了一个示例供您参考

    {
        "$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"
                }
            }
        ]
    }
    

    看起来像这样:

    点击:

    参考:https://adaptivecards.io/explorer/Action.ShowCard.html

    让我知道这是否适合您。快乐编码

    【讨论】:

      猜你喜欢
      • 2021-02-17
      • 2020-11-14
      • 2018-08-08
      • 2018-03-24
      • 1970-01-01
      • 2019-09-28
      • 2020-07-29
      • 2020-07-29
      • 2017-10-27
      相关资源
      最近更新 更多