How to call another intent without prompting to user in Lex?

后端 未结 2 1852
生来不讨喜
生来不讨喜 2021-01-18 18:08

Is it possible to trigger intent-B from the lambda function of intent-A without prompting to user?
Suppose user typed something and an intent-A is fired, after some proc

2条回答
  •  太阳男子
    2021-01-18 18:38

    Yes it is possible .From the lambda of Intent-A , you can write the below code :

            intentRequest.currentIntent.name='Intent-B';
            var param1={
                    slot-B:null
                };
                intentRequest.currentIntent.slots=param1;
              callback(elicitSlot(outputSessionAttributes, 'Intent-B', intentRequest.currentIntent.slots, 'slot-B'));
    

    Below is the function for elicitSlot

    function elicitSlot(sessionAttributes, intentName, slots, slotToElicit, message) {    
    return {
        sessionAttributes,
        dialogAction: {
            type: 'ElicitSlot',
            intentName,
            slots,
            slotToElicit,
            message,
        },
    };
    

    }

提交回复
热议问题