Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
excludeRelated Articles

How the State is used in

...

Voice or Chat experiences

Agents like Flow, Surveys, manage state, but it important to understand how to manage state in Experience designer.

Starting with an example, the following flowchart depicts user interaction with Alexa in which Yes and No are valid utterances to two questions. (An utterance is the word or phrase used by a user when speaking to Alexa.) For this flow to work correctly, there needs to be a way to differentiate the Yes responses, which is done by setting the state.

...

A None Intent fires if a user says something that maps to an Intent that is not valid for the current state, such as answering orange to a yes or no query.

Note: Alexa/Google maps everything a user says to an Intent.

...

Another example is to create a CancelIntent with the state set to AnyState that lets a user get out of whatever flow they are in and start over.

Some intent but one intent has the state “AnyState”, the other has the State “Survey”

If you create an intent with a state of AnyState, and the same intent with the State “Survey”

Note:

  1. The intent node with State=Survey will take priority over AnyState, if in the state Survey when an intent fires.

  2. AnyState includes noState. If you have 2 nodes, one with AnyState, and another with noState, and you are in the state noState, then the intent node State=noState will execute.

  3. The say node has a check box,  “Disable Any State Check For Next Request” Let's say you are in a flow doing a survey, and you do not want an intent that has AnyState to fire. For example, you probably would have the Answer Group intent node state=AnyState. An utterance that would have triggered the Answer Group intent does not instead it triggers the none intent, this would cause the flow manager to repeat the question.

How to use the state to affect the logical flow of the voice experience

The best place to set state in a flow is after an interaction with Alexa. That makes the Say node a perfect place to do this.

...

The drop-down for the Say node lists all possible states you can set. The list shows a number of the possible choices that are intents; either Amazon-specific intents such as YesIntent or intents you created. However, in the Sandbox State Demo, there are also values on this list like help and emergency, which are not intents but state names that are created in intents.

State values created in intents

The proper flow of the State Demo relies on knowing where a user is in a flow. In other words, the flow needs to know if is the user responding Yes that help is needed or Yes that this is an emergency. These two states need to be defined in the flow. This is done in the Intent Request node.

To create State values in an Intent Request node:

...

Open an Intent Request node in the flow.

...

In the State field, enter the values of the State relevant to this flow.

Click Update to save your changes.

...

The Set State drop-down list is populated by intent names and the launch node State comma-separated list.

...

Setting state in a flow

When you have states to choose from (whether those noted in this flow or all intents available in your skill), you can use them to direct the logic of the flow.

...