2

I have an intent to request a bank account info by it's number. I tried with only one slot of AMAZON.Number but if the account number is ***012345, Alexa understand this as ***012337 (last two digits are wrong). So now I use five slots for this (numberA, numberB, numberC, numberD and numberE, all those are AMAZON.Number) and concat their values (and works great).

My json model:

{
    "name": "GetAccountInfo_Intent",
    "slots": [
        {
            "name": "question",
            "type": "TYPE_getRequest"
        },
        {
            "name": "owner",
            "type": "TYPE_owner"
        },
        {
            "name": "accountByNumber",
            "type": "TYPE_accountByNumber"
        },
        {
            "name": "numberA",
            "type": "AMAZON.NUMBER"
        },
        {
            "name": "numberB",
            "type": "AMAZON.NUMBER"
        },
        {
            "name": "numberC",
            "type": "AMAZON.NUMBER"
        },
        {
            "name": "numberD",
            "type": "AMAZON.NUMBER"
        },
        {
            "name": "numberE",
            "type": "AMAZON.NUMBER"
        }
    ],
    "samples": [            
        "{owner} {accountByNumber} {numberA} {numberB} {numberC} {numberD} {numberE}",
        "{accountByNumber} {owner} {numberA} {numberB} {numberC} {numberD} {numberE}",
        "{accountByNumber} {numberA} {numberB} {numberC} {numberD} {numberE}",
        "{question} {accountByNumber} {numberA} {numberB} {numberC} {numberD} {numberE}",
        "{question} {owner} {accountByNumber} {numberA} {numberB} {numberC} {numberD} {numberE}",
        "{question} {accountByNumber} {owner} {numberA} {numberB} {numberC} {numberD} {numberE}"
    ]
},

I want the conversation with Alexa be something like this:

Me: Get my account with number ***012345.

Alexa: Did you request info from account number ***012345?

Me: Yes.

Alexa: Did you want all info, just IBAN or just bank name?

Me: Just bank.

Alexa: Your account with the number ***012345 belongs to bank XPTO.

Me: Can you repeat?

Alexa: Your account with the number ***012345 belongs to bank XPTO.

So I already searched a lot about dialog management (like this manual and many others links). But how can I request confirmation for multiple slots as one like my case? All must be checked to confirmation? How can I solve this? There is some good example for my case?

My lambda code:

"GetAccountInfo_Intent": function () 
{  
    var intent = this;
var number1Value = getSlotValue(intent.event.request.intent, "numberA");
var number2Value = getSlotValue(intent.event.request.intent, "numberB");
var number3Value = getSlotValue(intent.event.request.intent, "numberC");
var number4Value = getSlotValue(intent.event.request.intent, "numberD");
var number5Value = getSlotValue(intent.event.request.intent, "numberE");

var value = number1Value;

if(value == null)
    value = number2Value;
else if(number2Value != null)
    value += number2Value;

if(value == null)
    value = number3Value;
else if(number3Value != null)
    value += number3Value;

if(value == null)
    value = number4Value;
else if(number4Value != null)
    value += number4Value;

if(value == null)
    value = number5Value;
else if(number5Value != null)
    value += number5Value;

var updatedIntent = this.event.request.intent;
if (this.event.request.dialogState === 'STARTED') 
{
      this.response.speak("dialogState STARTED");
      this.emit(':delegate', updatedIntent);
} 
else if (this.event.request.dialogState != 'COMPLETED')
{
    if(value == null)
        this.emit(':elicitSlot', "numberA", "What are the account number you pretend?", "You must provide a account number. What are the account number you pretend?");
    else
        this.emit(':delegate', updatedIntent);
} 
else 
{
    if(this.event.request.intent.confirmationStatus == 'CONFIRMED'){
        this.response.speak("Your account number are " + value + ".");
        this.emit(':responseReady');
    }
    else{
        this.response.speak("Please repeat your account number again.");
        this.emit(':responseReady');
     }
}

},

I also do not understand the logic that the examples show for the lambda function (like in my code). How can I make this.emit(':elicitSlot') for all the slots as one?

Testing this on Alexa Developer Console is terrible. I can't debug on this... It is always saying "There was a problem with the requested skill's response".

Ninita
  • 153
  • 4

0 Answers0