如何添加响应卡
How to add response card
我正在尝试使用 C# .NET SDK
为 AWS Lex 创建一个机器人。我正在网上搜索并自己探索 AWS Lex API
参考资料,但仍然没有找到在我的机器人中添加 response card
的方法。
我检查了 PutSlotTypeRequest
、PutIntentRequest
和 PutBotRequest
,但仍然找不到将响应卡添加到我的插槽的方法。我见过名为 responseCard
的字段,但是,该字段的类型为 string
而不是 ResponseCard
类型。
ResponseCard
不是 Slot
或 Intent
的一部分,这就是为什么我们不能通过 PutSlotTypeRequest
或 PutIntentRequest
添加它。这是您的机器人提供的响应的一部分。
如果用户未填充插槽,您可以配置响应并向该响应添加响应卡。
下面的代码是如何添加响应卡的示例代码:
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled or Failed",
"message": {
"contentType": "PlainText or SSML",
"content": "Message to convey to the user. For example, Thanks, your pizza has been ordered."
},
"responseCard": {
"version": integer-value,
"contentType": "application/vnd.amazonaws.card.generic",
"genericAttachments": [
{
"title":"card-title",
"subTitle":"card-sub-title",
"imageUrl":"URL of the image to be shown",
"attachmentLinkUrl":"URL of the attachment to be associated with the card",
"buttons":[
{
"text":"button-text",
"value":"Value sent to server on button click"
}
]
}
]
}
}
更多ResponseCard详情请查看
希望对您有所帮助。
我正在尝试使用 C# .NET SDK
为 AWS Lex 创建一个机器人。我正在网上搜索并自己探索 AWS Lex API
参考资料,但仍然没有找到在我的机器人中添加 response card
的方法。
我检查了 PutSlotTypeRequest
、PutIntentRequest
和 PutBotRequest
,但仍然找不到将响应卡添加到我的插槽的方法。我见过名为 responseCard
的字段,但是,该字段的类型为 string
而不是 ResponseCard
类型。
ResponseCard
不是 Slot
或 Intent
的一部分,这就是为什么我们不能通过 PutSlotTypeRequest
或 PutIntentRequest
添加它。这是您的机器人提供的响应的一部分。
如果用户未填充插槽,您可以配置响应并向该响应添加响应卡。
下面的代码是如何添加响应卡的示例代码:
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled or Failed",
"message": {
"contentType": "PlainText or SSML",
"content": "Message to convey to the user. For example, Thanks, your pizza has been ordered."
},
"responseCard": {
"version": integer-value,
"contentType": "application/vnd.amazonaws.card.generic",
"genericAttachments": [
{
"title":"card-title",
"subTitle":"card-sub-title",
"imageUrl":"URL of the image to be shown",
"attachmentLinkUrl":"URL of the attachment to be associated with the card",
"buttons":[
{
"text":"button-text",
"value":"Value sent to server on button click"
}
]
}
]
}
}
更多ResponseCard详情请查看
希望对您有所帮助。