aws-lambdaaws-lex

how to use ConfirmIntent in Amazon Lex and Lamda


I am trying to call a Intent-B from Intent-A

WelcomeBot - Intent A AccountVerify - Intent B

When I send help from lex it will trigger the WelcomeBot Message and the below mentioned are my Lamda Response to Lex

{
  "dialogState": "ConfirmIntent",
  "intentName": "AccountVerification",
  "message": "Do you have your account number?",
  "messageFormat": "PlainText",
  "responseCard": null,
  "sessionAttributes": {
    "confirmationContext": "AutoPopulate"
  },
  "slotToElicit": null,
  "slots": {
    "AccountID": ""
  }
}

In IntentName Key I placed the AccountVerify Intent Name

But When I type "Yes" (Since I am using the ConfirmIntent) or an account number it is giving me an error message

An error has occurred: Invalid Lambda Response: Received error response from Lambda: Unhandled

enter image description here


Solution

  • Return the Below object in case of confirmIntent.

    { 
       "dialogAction":{ 
          "type":"ConfirmIntent",
          "message":{ 
             "contentType":"PlainText",
             "content":"Message"
          },
          "intentName":"intentName",
          "slots":{ }
       }
    }