Events and Transitions
In dialog flows developed with the Visual Flow Designer, events are used to route a conversation to flows or states within flows.
At the skill level, events are broken down into the following types:
- Intent. These events correspond to the skill's intents. Such an event occurs when user input resolves to a given intent.
- Built-In. These are standard events for typical use cases like unresolved intent, answer intent, and dialog error.
- End Flow Action. These are events that you define yourself and which can be triggered by actions in end flow states (both states that use the End Flow component and states which implicitly end the flow).
At the flow level, events are broken down into the following types:
- System Transitions. These are built-in events for typical use cases like unresolved user input, required authorization, and errors.
- Custom Transitions. These are events that you can specify yourself and which are typically assigned to component transitions actions. When the flow reaches such a transition, the corresponding event is fired, and the state mapped to the event is invoked.
Built-In Events for the Main Flow
Event | When Fired | How to Use |
---|---|---|
Start Skill | When a skill starts for the first time. | Map to a custom flow to do such things as initalize backend systems or display a Help menu. |
Dialog Error | When an error is thrown by a component during a conversation. This event can also be fired when there is an error in another flow and that flow's Dialog Error system transition isn't mapped. | Map to a custom error-handling flow. If this event is fired but there is no
mapping, the current flow is terminated and the skill outputs the
default error message ("Oops! I’m encountering a spot of
trouble )".
|
Answer Intent | When an answer intent is resolved. | Map to a custom flow dedicated to answer intents. |
Unresolved Intent | When the user intent is unresolved. | Map to a custom help flow. |
Digital Assistant Help | When the user expresses a request for help. This only applies when the user has accessed the skill through a digital assistant and the skill is in the digital assistant's current context. | Map to a custom help flow. |
Digital Assistant Welcome | When the user initiates contact with the digital assistant. This only applies when the user has used explicit invocation to access the skill through a digital assistant but has not expressed an intent. | Map to a custom welcome or help flow. |
Note:
By specifying flows for the Digital Assistant Help and Digital Assistant Welcome events, you are not completely overwriting the behavior for the digital assistant's help and unresolvedIntent system intents. If you want to universally change that behavior, you do so in the digital assistant's settings. See Specify States for a Digital Assistant's System Intents.System Transitions for Flows
For each flow, you can take advantage of system transitions to define where you handle events such as dialog errors and out of order messages.
To define the state that is used to handle a given event:
- On the flow's Configuration tab, scroll down to and expand
the Events Mappings section.
You'll see the System Transitions sub-section.
- For the event that you want to map, select the state that you want to map it
to.
This state would typically be an Invoke Flow component that points to the utility flow for handling the event. See Invoke One Flow from Another Flow.
Here are the events that you can map as system transitions in a flow.
Event | When Fired | How to Use |
---|---|---|
Authorize User | When a state is reached where its Requires
Authorization state resolves to
true .
|
Map to an Invoke Flow component that calls an authorization flow. |
Dialog Error | An unexpected error occurs in the conversation. |
Map to an Invoke Flow component that calls a flow for error handling. If this event isn't mapped and an error occurs in the
flow, the error handling flow that's mapped to the Dialog Error
built-in event for the main flow gets
invoked. When Dialog Error is mapped neither for the flow nor for
the main flow, the skill outputs the default error message
( |
Out-of-Order Message | The user selects an option from a previous message in the conversation instead of from the current message. | Map to an Invoke Flow component that calls a flow you have provided for handling out-of-order messages. |
Unexpected User Input | The user provides textual input instead of selecting one of the options provided in the message. | Map to an Invoke Flow component that calls a flow you have provided for handling unexpected input. |
Event Listening and Triggering
When you have nested flows (flows with sub-flows):
- The current flow both listens for and triggers built-in and end flow action events.
- The calling flow only listens for end flow action events that are
triggered by the current flow. Then, when the sub-flow that has triggered an end
flow action event has finished, the parent flow acts on the triggered event.
The primary example of this is when a sub-flow's Action property specifies an end flow action event.