Session opening and closing at the end of an interaction, after fulfilling the user request makes up for one of the core user experiences in any skill. It can make or break the customer experience. For an ideal experience, the session should close after completing the task when the user is not prompted for inputs within 8 seconds.
Here is an example of a good user experience when a session closes when not prompted for user inputs:
User: Alexa open my toothbrush and teach me how to brush
Skill: Hold your toothbrush at 45 degrees, and brush the outer surface of your upper teeth starting on the left side. Start at the upper left. Boom ..Now the upper right… Bingo ..Time for the lower left.. Bingo and now, the lower right. Righto.. Now let's scrub along the chewing surfaces. Okay ..Now let’s scrub your tongue! All Done! Let's rinse and spit. <session closes>
Let’s have a look at another example for conversational skills where the session doesn’t close due to the nature of the skill and it ends with a question instead. Further commencement of the session would be based on user input.
User: Alexa open Pikachu talk
Skill: Hello. With Pikachu Talk, you can talk to Pikachu in your own home. Pikachu is here now. Pikachu can understand what you say. What's your name? It's saying... I'm Pikachu! Nice to meet you, Pikachu! Why don't you try speaking to Pikachu?
User: Pikachu, what should I do today?
Skill: Today is good day to go on a treasure hunt, would you like me to proceed? <session remains open>
In this case, if the user does not provide any input, the session must close. After every response that asks the user a question, the session remains open and the device waits for user response.
Now, let’s have a look at an example of a not so ideal user experience. In this case, the skill session remains open with no prompt to the user for further inputs.
User: Alexa, open Space Facts.
Alexa: A year on Mercury is just 88 days long. <session remains open>
This above example provides a bad customer experience as skill provides just one line and does not guide the user on the next steps in interacting with the skill. Let’s look at another example here:
User: Alexa, Open cat facts and give me a fact
Alexa: Welcome to cat facts, did you know that cats are nearsighted, but their peripheral vision and night vision are much better than.. <session remains open>
This is another example of a bad customer experience where the skill gives incomplete sentences and the session remains open. In such cases, there are no navigational guidelines for the user either in skill prompts or in the description and eventually they end up not using the skill. Hence, these skills will be failed during certification to ensure that each skill offers only the best customer experience.
Now let’s have a look at another good user experience, where the developer provides details in the description or skill prompts on why the session status should/ will remain open and when it will close/ session will extend.
Skill Description: The recipes are enhanced with step-by-step voice instructions, and there's no need to touch the screen or respond just move through the recipe at your own pace by saying "next step" when you are ready to move on.
Prompts in skill navigation:
User: Alexa , how to make hummus?
Skill: Here’s what all you need to make hummus- a can of chickpeas, 3 tbsps. tahini, 1 tsp cumin, half a lemon juiced, 2 garlic pods and salt. Mention next step when you are ready to move on to the next stage in the recipe.
User: Next step
Skill: Drain and rinse the chickpeas from the can, add to a blender with 3 teaspoons water <session remains open waiting for further user inputs>
This use case will be passed in certification as the developer has provided details in the description and in skill prompts that user input is needed for the next input from the skill.
How to fix session closure issues?
Now, we will look at how to fix session closure issues to ensure an ideal user experience.
To ensure that the session is closed when there is no user input, we should check if “ShouldEndSession” attribute is marked to “true”. This can be done when adding intent responses while building the skill. We should ensure that after every response that asks the user a question, the session remains open and after every response that completes the user's request, the session ends. The skill should open a new session after the welcome prompt, even though the skill already fulfilled the users initial request.
Below is a quick checklist to ensure proper session management while building skills:
- Provide a complete and fulfilling response to the request made by the user.
- End the skill response with a question, if user input is required to navigate further. Session must remain open in this case to wait for user input.
- When user input is not required, we must ensure that “ShouldEndSession” attribute is marked to true.
- The session should close after completing the task when the user is not prompted for inputs within 8 seconds
Check out this link for further information on session closure, https://developer.amazon.com/en-US/docs/alexa/custom-skills/request-and-response-json-reference.html#response-object.
Happy Skill Building!