David_Zizu
David_Zizu

Reputation: 1039

How to add response card

I am trying to create a bot using C# .NET SDK for AWS Lex. I was searching online and exploring AWS Lex API reference on my own but still haven't found a way to add response card in my bot.

I have checked PutSlotTypeRequest, PutIntentRequest, and PutBotRequest but still couldn't find a way to include response card to my Slot. I have seen field called responseCard however, this field is of type string and not a ResponseCard type.

Upvotes: 0

Views: 615

Answers (1)

sid8491
sid8491

Reputation: 6800

ResponseCard is not part of Slot or Intent, that is why we can not add it through PutSlotTypeRequest or PutIntentRequest. It is part of the response which your bot is providing.
You can configure a response if a slot is not filled by the user and add a response card to that response.

Below code is the sample code of how to add response card:

"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"
                 }
              ]
           } 
       ] 
     }
  }

For more details about ResponseCard, please check this answer.

Hope it helps.

Upvotes: 2

Related Questions