question

ROGERIO M COELHO avatar image
ROGERIO M COELHO asked

AlexaTextList with intents

Hi,

I have an AlexaTextList which is an options menu. The first option is to "Add New User". The user chose option 1 (Add New User).

I can identify that user chose option 1 in AlexaTextListHandler.

How to call my AddUserIntent inside AlexaTextListHandler? I need the "name" and "phone" from slots AddUserIntent.


const AlexaTextListHandler = {

canHandle(handlerInput) {

return ((handlerInput.requestEnvelope.request.type === 'Alexa.Presentation.APL.UserEvent' &&

(handlerInput.requestEnvelope.request.source.handler === 'Press' ||

handlerInput.requestEnvelope.request.source.handler === 'onPress')));

},


handle(handlerInput) {

let elemento = handlerInput.requestEnvelope.request.arguments[1];


//Option Add new User

if(elemento === 1){

<AddUserIntentHandler> - "I need this point run intent AddUser since begin!"

} else if(elemento === 2){


}

...

return handlerInput.responseBuilder

.speak(speechText)

.getResponse();

}

};


const AddUserIntentHandler = {

canHandle(handlerInput) {

return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest'

&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'AddUser';

},

async handle(handlerInput) {

let speechText = 'OK! Operação de cadastrar medicamento foi cancelada!';

const {requestEnvelope} = handlerInput;

const {intent} = requestEnvelope.request;

if(intent.confirmationStatus === 'CONFIRMED'){

const intentValues = handlerInput.requestEnvelope.request.intent.slots;

const name = Alexa.getSlotValue(requestEnvelope, 'Nom');

const phone = Alexa.getSlotValue(requestEnvelope, 'Tel');

....


intentsaplalexa lists
2 comments
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I tried this code to call intent

...

return handlerInput.responseBuilder

.addDelegateDirective('AddUserIntent')

.getResponse();

...

But I have this error:

2021-08-23T01:42:32.058Z 6d5ecf07-4939-473e-b21b-40c4f53de876 INFO ~~~~ Error handled:

{ "name": "AskSdk.GenericRequestDispatcher Error" }
0 Likes 0 ·
Hello,

Please check my answer here.

Regards,
Gaetano

0 Likes 0 ·

0 Answers