JulienCoo
JulienCoo

Reputation: 1198

Alexa Skills - Maintain session in the simulator

I'm trying to maintain a session in the simulator so that I can chain intents and not have to start each sentences with "tell my skill {something}". Each time i trigger an Intent, I can see in the output JSON that the session.new is always true.

What do I do wrong ?

Thanks a lot.

Upvotes: 0

Views: 137

Answers (2)

user3676759
user3676759

Reputation: 11

In node.js I realized that you do need the "repompt" part to keep the session attributes :

handlerInput.responseBuilder
                .speak(speechText)
                .reprompt(speechText)
                .withSimpleCard('Hello World', speechText)
                .getResponse();

Upvotes: 1

davidgyoung
davidgyoung

Reputation: 64941

Make sure that when you send responses, you use a "ask" response instead of a "tell" response. A tell response will close the session.

With the Java SDK, you can create an ask response with:

SpeechletResponse.newAskResponse(speech, reprompt, card);       

Whereas the tell response is created with:

SpeechletResponse.newTellResponse(speech, card);

Upvotes: 1

Related Questions