代码之家  ›  专栏  ›  技术社区  ›  David_Zizu

如何添加响应卡

  •  0
  • David_Zizu  · 技术社区  · 7 年前

    我正在尝试使用 C# .NET SDK 对于 AWS Lex公司 . 我在网上搜索和探索 AWS Lex API 我自己的参考,但仍然没有找到添加的方法 response card 在我的机器人中。

    我查过了 PutSlotTypeRequest , PutIntentRequest PutBotRequest 但仍然无法找到将响应卡包含到我的插槽中的方法。我看过field的电话 responseCard 但是,此字段的类型为 string 而不是 ResponseCard 类型

    1 回复  |  直到 6 年前
        1
  •  2
  •   sid8491    7 年前

    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的更多详细信息,请查看 this answer.

    希望有帮助。