![](/img/trans.png)
[英]Action.Submit on Adaptive cards is not calling the next step (not working only in Microsoft Teams works in web chat) : Bot Framework V4
[英]Adaptive Cards and Microsoft Bot Framework: will only permit 'openUrl' action?
編輯 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\"}"
}
}
}
]
}
你正在做的事情有很多問題。 建議大家使用 Bot Builder v4 而不是 v3。 您的同事解決的主要問題是您試圖將 Adaptive Card 對象用作附件對象。
您鏈接到的博客文章解釋了 Adaptive Cards 必須遵循 Adaptive Cards 架構。 自適應卡片架構中沒有Action.messageBack
。 請繼續參考文檔以獲取更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.