将参数传递给 MS Teams 自适应卡中的 Action.OpenUrl 按钮

Passing parameters to Action.OpenUrl button within adaptive card in MS Teams

我正在为 Microsoft Teams 中的自适应卡片而苦苦挣扎。卡片的显示有效,但我似乎无法让操作按钮起作用。我想做的是将参数传递给 URL。参数值应该是用户在名为“nameInput”的文本字段中输入的值。例如“Alice”应该打开 URL “https://www.google.de/search?q=Alice”。不知何故,该按钮似乎在 MS Teams 中不起作用。这个让我很头疼...这有可能吗?

"https://www.google.de/search?q={{nameInput.value}}" 和 ""https://www.google.de/search?q=${nameInput.value}" 也不起作用... :-(

{
    "type": "message",
    "attachments": [
        {
            "contentType": "application/vnd.microsoft.card.adaptive",
            "contentUrl": null,
            "content": {
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                "type": "AdaptiveCard",
                "version": "1.3",
                "body": [
                    {
                        "type": "TextBlock",
                        "text": "Testcard",
                        "size": "Medium",
                        "weight": "Bolder",
                        "wrap": "true"
                    },
                    {
                        "type": "Input.Text",
                        "id": "nameInput",
                        "placeholder": "Type your name"
                    }
                ],
                "actions": [
                    {
                        "type": "Action.OpenUrl",
                        "title": "OK",
                        "url": "https://www.google.de/search?q={nameInput.value}"
                    }
                ]
            }
        }
    ]
}

自适应卡不支持此方案。传递参数支持通过提交动作给机器人。

或者,您可以使用 html 输入创建任务模块并提交任务模块以取回响应

https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/what-are-task-modules