1
votes

I have an Alexa skill with multiple intents and a customer back-end built with Python SDK. I currently can use the skill on my speaker. The thing that I would like to try and fix is keeping the session open, or the blue light on the speaker in between intents. So instead of:

Me: Alexa, start the quiz 
Alexa: Hi, tell me your name 
Me: my name is Jeff 
Alexa: Nice to meet you Jeff, where are you from? 
Me: Alexa, I'm from Texas

^ I need to wake up the speaker to tell her where I'm from when wanting to use the CaptureCustomerLivingIntentHandler() class after giving her my name. I'd like for the speaker to listen in on the next intent. Something like below:

Me: Alexa, start the quiz
Alexa: Hi, please tell me your name
Me: My name is Jeff
Alexa: Nice to meet you Jeff, where are you from?
Me: I'm from Texas

What do I need to add to my code to keep the speaker on in between each intent so the speaker doesn't shut off? I tried finding some documentation around this but had trouble finding something that would explain on how to tackle this problem using Python as the back-end to build the skill.

1

1 Answers

1
votes

If you want to keep the session open, you'll need to include the shouldEndSession parameter in your response, and make sure that you set this to False.

In Python, this could look like:

{
  "version": "1.0",
  "response": {
    "outputSpeech": {
      "type": "PlainText",
      "text": "Nice to meet you Jeff, where are you from?", 
    },
    "shouldEndSession": False,
}

Or if using the ASK SDK for Python:

handler_input.response_builder.speak(
    "Nice to meet you Jeff, where are you from?").set_should_end_session(False).response

It's important to point out that when you keep the session open, Amazon guidelines state that need to make sure you're prompting the user for more input (i.e. ask the user a question) - which you correctly do in your example.

You may already have looked here, but figured it was worth also linking specifically to the documentation about managing the skill session.