article

KirkC@Amazon avatar image
KirkC@Amazon Posted · · Taira@Amazon edited ·

Understanding Session Management - Test Case 4.1

Every response sent from your skill's back-end should include a shouldEndSession key-value pair. Acceptable values are either true or false.

  • A value of true means that after Alexa finishes speaking the outputSpeech content. She will not listen for any further user input and the skill session will end.
  • A value of false means that after Alexa finishes speaking the outputSpeech content. She will keep the skill session open and listen for further user input. Alexa keeping the session open and listening for user input is also indicated by the blue light ring on Echo devices.

Per test case "4.1 Session Management" all skill responses must close the session ("shouldEndSession": true) unless the outputSpeech ends in the form of a question.

Please note that providing a reprompt object does not negate this requirement as the verbal reprompt only occurs after several seconds of the session having already been left open.

Let's review a few example skill interactions below:



1. Correct Session Management Example: Session Remains Open And User Is Prompted For Input

Customer: Alexa, ask Space Facts for a fact
Alexa: Jupiter has the shortest day of all the planets. Would you like to hear another fact? <session remains open>

Skill JSON Response

{
   "body": {
      "version": "1.0",
      "response": {
         "outputSpeech": {
            "type": "SSML",
            "ssml": "<speak>Jupiter has the shortest day of all the planets. 
                    Would you like to hear another fact?</speak>"
         },
         "shouldEndSession": false
      }
   }
}

The example scenario above is acceptable because although the session remains open, as shown with the key-value pair "shouldEndSession": false, the outputSpeech.ssml string value ends in the form of a question.

2. Incorrect Session Management Example: Session Remains Open Without Prompt To User

Customer: Alexa, ask Space Facts for a fact
Alexa: Here's a fact. A year on Mercury is just 88 days long. <session remains open>

Skill JSON Response

{
   "body": {
      "version": "1.0",
      "response": {
         "outputSpeech": {
            "type": "SSML",
            "ssml": "<speak>Here's a fact. A year on Mercury is just 88 days 
                    long.</speak>"
         },
         "shouldEndSession": false
      }
   }
}

The example scenario above is unacceptable because the session remains open, as shown with the key-value pair "shouldEndSession": false while the outputSpeech.ssml string value does not end in the form of a question. Therefore, Alexa is listening for user input, without having told the user in advance that she's waiting for a response.

3. Correct Session Management Example: Session Closes And User Is Not Prompted For Input

Customer: Alexa, ask Space Facts for a fact
Alexa: On Mars, the Sun appears about half the size as it does on Earth. <session closes>

Skill JSON Response

{
   "body": {
      "version": "1.0",
      "response": {
         "outputSpeech": {
            "type": "SSML",
            "ssml": "<speak>On Mars, the Sun appears about half the size as it does                     on Earth.</speak>"
         },
         "shouldEndSession": true
      }
   }
}

The example scenario above is acceptable because although the session closes, as shown with the key-value pair "shouldEndSession": true, the outputSpeech.ssml string value did not prompt the user for any further input.

4. Incorrect Session Management Example: Session Closes Where User Was Prompted For Input

Customer: Alexa, ask Space Facts for a fact
Alexa: The Sun is an almost perfect sphere. Would you like to hear another fact? <session closes>

Skill JSON Response

{
   "body": {
      "version": "1.0",
      "response": {
         "outputSpeech": {
            "type": "SSML",
            "ssml": "<speak>The Sun is an almost perfect sphere. Would you like to                      hear another fact?</speak>"
         },
         "shouldEndSession": true
      }
   }
}

The example scenario above is unacceptable because although the session closes, as shown with the key-value pair "shouldEndSession": true, the outputSpeech.ssml string value prompted the user for additional input the user by asking a question.

Additional Documentation

https://developer.amazon.com/docs/custom-skills/request-and-response-json-reference.html

alexa skills kitcertificationsession
10 |2000 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.

Article

Contributors

Taira@Amazo contributed to this article KirkC@Amazon contributed to this article