0
votes

Please find below details :

  1. Intent with utterances

    enter image description here

2.AWS lambda intent handler code

 const DeliveryPercentage_Handler = {
   canHandle(handlerInput) {
   const request = handlerInput.requestEnvelope.request;
   return (
    request.type === "IntentRequest" &&
    request.intent.name === "DeliveryPercentage"
  );
},
 async handle(handlerInput) {
  const request = handlerInput.requestEnvelope.request;
  const responseBuilder = handlerInput.responseBuilder;
  let sessionAttributes = 
handlerInput.attributesManager.getSessionAttributes();

var num2 = request.intent.slots;
if (num2) {
  console.log("numb2");
  console.log(JSON.stringify(num2));
  output1 = "The sum of " + num2 + " and " + num2 + " is " + (num2 + num2);
}

// let dataResponse = await getShipmentInPercentage(1,"Delivery");
// let say = "Your delivery percentage is " + (dataResponse.percentage);

let say = "test " + num2.numbnew.value;
return responseBuilder
  .speak(say)
  .reprompt("try again, " + say)
  .getResponse();

} };

3.Getting the slots with name but not the value in it

END RequestId: a260e0f4-69a5-47a0-bcb5-91020a1b94f6 REPORT RequestId: a260e0f4-69a5-47a0-bcb5-91020a1b94f6 Duration: 0.91 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 75 MB
START RequestId: 87e8761d-e725-43b6-bb83-a4ca93b3d6c3 Version: $LATEST 2020-02-28T12:41:15.391Z 87e8761d-e725-43b6-bb83-a4ca93b3d6c3 numb2 2020-02-28T12:41:15.391Z 87e8761d-e725-43b6-bb83-a4ca93b3d6c3
{ "numbnew": { "name": "numbnew", "confirmationStatus": "NONE" } }

END RequestId: 87e8761d-e725-43b6-bb83-a4ca93b3d6c3 REPORT RequestId: 87e8761d-e725-43b6-bb83-a4ca93b3d6c3 Duration: 247.16 ms Billed Duration: 300 ms Memory Size: 128 MB Max Memory Used: 76 MB

Slot log value is missing ** { "numbnew": { "name": "numbnew", "confirmationStatus": "NONE" } } **

Any help would be appreciated

Thanks in advance !

1

1 Answers

1
votes

Utterances that you have set for your intent DeliveryPercentage is

"What is the delivery percentage {numbnew}"

where {numbnew} is your intent slot which will collect value for above utterances, I guess when you are testing this skill you are only saying "What is the delivery percentage" instead you need to say "What is the delivery percentage 80" or any number you want!

then you will get following response in your request

"slots": {
        "numbnew": {
            "name": "numbnew",
            "value": "80",
            "confirmationStatus": "NONE",
            "source": "USER"
        }
    }

Suggestion, if you are trying to collect percentage data from user, then try to make this question "What is the delivery percentage" in response builder of AWS lambda intent handler and make Utterances with something like this "My percentage is {numbnew}"