0
votes

I'm trying to switch Intents, without using ElicitSlot. The reason is because my next Intent does not require slots or user input.

Currently I am using ElicitSlot. In the Greetings intent, I set the slot Nums. In the news intent, I check if the slot 'Nums' exist and proceed accordingly. However this doesn't work, and it still asks for the Prompt for the 'Nums' slot.

Current Greetings Intent: Fulfillment

var sessionAttributes = intentRequest.sessionAttributes;
var slots = intentRequest.currentIntent.slots;

const num = slots.Num;
    
if(num == 1){
    str = 'News';
    intentRequest.currentIntent.name = 'News';
    intentRequest.currentIntent.slots = {
        Nums: 3
    }
    callback(close(sessionAttributes, str, intentRequest.currentIntent.slots, 'Nums'));
}

Current News Intent: Lambda initialization and validation

if(!slots.Nums){
    slots.Nums = intentRequest.inputTranscript;
    callback(close(sessionAttributes, 'News', slots, 'Nums'));
}

if(slots.Nums){
    callback(close(sessionAttributes, 'News', slots, 'Displaying News...'));
}

Example Successful Dialog:

User: Hi

Bot: Welcome: (1) News (2) Option2 (3) Option 3

User: 1

Bot: Displaying News...

1

1 Answers

0
votes

This is not currently possible with Lex + Lambda. Since you can trigger the other intent by voice/words, while using this menu for DTMF/digit, I do recognize the need.

One work-around is for you to call the "Display News" intent code yourself. Since the example code is Lambda code, you can control the flow of that code without relying on Lex to mediate it.

if(num == 1){
    callback(close(sessionAttributes, 'News', slots, 'Displaying News...'));
}