Flow Mapping

The following topics show the various types of events from which you can map to a flow.

Map an Intent to a Flow

You can map an intent to a flow when you create the flow:

  1. On the Events page, click + Add Flow.
  2. In the Create Flow dialog, fill in the required fields, including Intent Name.

If you have already defined a flow and now need to map an intent to it, here's how you map the intent:

  1. On the Flows page, in the list of flows, select Main Flow.
  2. Click This is an image of the Add icon. in the Intent Events section.
    This is an image of the Intent Events section header.

  3. In the Create Intent Event Handler dialog, select the intent name and mapped flow, and then click Create
    Description of df_create_intent_event_handler_dialog.png follows

    .

Map a Built-In Event to a Flow

  1. Select Main Flow.
  2. Click This is an image of the Add icon. in the Built-In Events section.
    This is an image of the Built-In Events header.

  3. In the Create Built-In Event Handler dialog, select the event type from the and mapped flow, and click Create.
    Description of df_2_0_built-in_events_mapping_dialog.png follows

Map a Transition Event to a Flow

  1. Select the flow to which you want to map the event.
  2. Select the Configuration tab.
  3. Expand the Event Mappings section.
  4. In the field for the transition that you want to map, select a state.

Invoke One Flow from Another Flow

If you want to call a flow from another flow, you do so by using Invoke Flow and End Flow components. Here's how it works:

  • The parent flow calls the child flow from an invoke flow state. It uses this state to pass values to and receive values from the child flow.
  • The child flow's end flow state passes its output parameters back to the parent flow and can also trigger an action that the parent flow executes after the child flow has ended.

    If the child flow branches and has multiple end flow states, each can pass its own action back to the parent flow, and the parent flow can use these actions to determine which branch to follow.

    (Action transitions enable you to branch the parent flow based on the results of the child flow. For example, if you have a child flow that is supposed to look up an account, it could pass an action for success and an action for failure.)

  • After the child flow has ended, the parent flow resumes.

For example, an Update Account flow in a finance skill would be the parent flow that can only complete the user's update request by calling a child flow, Get Account. The result, or output parameter that the parent flow expects after the child flow executes, is the user account. In this case, the account is the output parameter sent to the invoke flow state by the child flow's end flow state.

To link flows:
  1. Create the input and output parameters for the child flow.
  2. In the parent, or calling flow, click the Add State icon at the point where you want to call the child flow and select the Flow Control > Invoke Flow component. Then click Insert.
  3. Open the property inspector for the invoke flow state that you just added.
  4. On the General page, enter a name and a description.
  5. On the Component page, select the child flow from the Flow dropdown.
  6. If the parent flow needs to pass parameters to the child flow, click Add, then select the input parameter belonging to the child flow and enter a default value. Then click Save. Repeat this step for each input parameter.
  7. If the parent flow expects a result from the child flow, click Add to select the output parameter belonging to the child flow and then name the variable of the current (parent) flow that gets set to the value of the output parameter.
  8. Open the Transitions page to set the next state and, if needed, add action transitions such as cancel or error.
  9. If you have configured action transitions in the parent flow, configure end flow states in the child flow to trigger those actions. You do those on the Component page of each end flow's property inspector.
  10. If you need to pass a parameter back to the parent flow, click Add and then enter the name that matches the parameter name in the parent flow's invoke flow state. Then enter a parameter output value and click Save.

Invoke Another Skill from a Flow

If you want to call another skill from a flow, you do so by using Invoke Skill and End Flow components. Here's how it works:

  • The skill that you are calling must be in the same digital assistant as the skill you are calling from.
  • The skill that you are calling must have a flow that's designated as public.
  • The calling flow uses an Invoke Skill state to specify a version of a skill and a target flow in that skill. It uses this state to pass values to and receive values from the called skill.
  • The target flow's end flow state passes its output parameters back to the calling flow and can also trigger an action that the calling flow executes after the target flow has ended.

    If the target flow branches and has multiple end flow states, each can pass its own action back to the calling flow, and the calling flow can use these actions to determine which branch to follow.

    (Action transitions enable you to branch the calling flow based on the results of the target flow. For example, if you have a target flow that is supposed to look up an account, it could pass an action for success and an action for failure.)

  • After the target flow has ended, the calling flow from the calling skill resumes.

For example, an Update Account flow in a finance skill would be the calling flow that can only complete the user's update request by calling a target flow, Get Account. The result, or output parameter that the calling flow expects after the target flow executes, is the user account. In this case, the account is the output parameter sent to the invoke skill state by the target flow's end flow state.

To link flows:
  1. Create the input and output parameters for the target flow.
  2. In the target flow, select the Configuration tab, expand the General section, and turn the Public switch on.
    This is a screenshot of part of the Configuration page that shows the Require Authorization field and the Public switch.

  3. In the calling flow, click the Add State icon at the point where you want to call the target flow and select the Flow Control > Invoke Skill component. Then click Insert.
  4. Open the property inspector for the invoke skill state that you just added.
  5. On the General page, enter a name and a description.
  6. On the Component page, select skill from the Skill dropdown.
  7. Select a version from the Skill Version dropdown.
    Note

    This value only applies if the referenced skill is a standalone skill. If the target skill is in the same digital assistant as the calling skill, at runtime the version of that skill that is in the digital assistant is used and the value of this field is ignored.
  8. From the Flow Name dropdown, select one of the public flows that belong to the selected skill.
  9. If the calling flow needs to pass parameters to the target flow, click Add, then select the input parameter belonging to the target flow and enter a default value. Then click Save. Repeat this step for each input parameter.
  10. If the calling flow expects a result from the target flow, click Add to select the output parameter belonging to the target flow and then name the variable of the calling flow that gets set to the value of the output parameter.
    Note

    If the target flow isn't yet available, you can specify that the flow use mock data for the output parameters so that you can continue developing and testing the flow while waiting for the target flow to become available. To do so, set the Use Mock property to True and enter output parameters and values in the Mock Output Parameters field. Enter each parameter on a separate line in the form
    ParamName: ParamValue
  11. Open the Transitions page to set the next state and, if needed, add action transitions such as cancel or error.
  12. If you have configured action transitions in the calling flow, configure end flow states in the target flow to trigger those actions. You do those on the Component page of each end flow's property inspector.
  13. If you need to pass a parameter back to the calling flow, click Add and then enter the name that matches the parameter name in the calling flow's invoke skill state. Then enter a parameter output value and click Save.