【发布时间】:2019-11-26 11:20:43
【问题描述】:
编辑 2:以下架构(由同事提供)有效。我从 Microsoft 的示例中的架构中删除了引号,但这仍然不起作用。我不确定问题是什么。如果其他人想提供答案,我会保留这个问题,但我已经解决了。
const card = {
contentType: 'application/vnd.microsoft.card.adaptive',
content: {
$schema: 'http://adaptivecards.io/schemas/adaptive-card.json',
type: 'AdaptiveCard',
version: '1.0',
{
type: 'Input.Text',
placeholder: 'Name',
style: 'text',
maxLength: 50,
id: 'defaultInput'
},
actions: [
{
type: 'Action.Submit',
title: 'Siguiente',
data: {} // will be populated with form input values
}
]
}
};
我正在尝试使用自适应卡片在我的 MS Bot 中制作表格。我从 MS 站点 (https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/) 获取了示例表单,但出现以下错误
错误似乎认为我的操作类型是Action.openUrl,但我在下面的代码中没有看到。非常感谢任何帮助。使用 Microsoft Bot Framework 3,节点 12.13.0。
function askPolicyNumber(session) {
const card = {
'$schema': 'https://adaptivecards.io/schemas/adaptive-card.json',
'type': 'AdaptiveCard',
'version': '1.1',
'body': [
{
'type': 'Input.Text',
'id': 'id_text'
},
{
'type': 'Input.Number',
'id': 'id_number'
}
],
'actions': [
{
'type': 'Action.messageBack',
'title': 'Submit',
'data': {
'prop1': true,
'prop2': []
}
}
]
};
const msg = new builder.Message(session).attachments([card]);
return session.send(msg);
}
编辑:
似乎无论我设置什么动作,它都一直认为这是一个openUrl 动作。事实上,如果我将它设置为 openUrl 并给它一个 url 属性,它就可以正常工作。
我查看了这个页面 -- https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-actions#adaptive-cards-actions -- 并按照那里的“带有 messageBack 操作的自适应卡”的说明进行操作,但它没有改变任何东西
"actions": [
{
"type": "Action.Submit",
"title": "Click me for messageBack",
"data": {
"msteams": {
"type": "messageBack",
"displayText": "I clicked this button",
"text": "text to bots",
"value": "{\"bfKey\": \"bfVal\", \"conflictKey\": \"from value\"}"
}
}
}
]
}
【问题讨论】:
标签: node.js botframework adaptive-cards