Studio uses Widgets to represent various parts of Twilio's functionality that can then be stitched together in your Studio Flow to build out robust applications that require no coding on your part.
New to Twilio Studio? Check out our Getting Started guide!
The Run Subflow Widget allows you to invoke a Subflow from a parent Flow.
The Run Subflow Widget requires several pieces of information to function properly. The Studio Flow where the Subflow is located must be specified along with the revision.
Name | Description | Example | Default |
---|---|---|---|
Flow | The Studio Flow that contains the Subflow. | My first flow | N/A |
Revision | The revision of the Subflow to use at runtime. Select "Latest Draft" or "Latest Published" to have Studio dynamically select the correct revision at runtime. | Latest Published Revision | N/A |
Multiple references to the same Subflow within a parent Flow must all target the same Flow Revision.
The Run Subflow Widget also accepts parameters you can configure to be passed into the Subflow.
Name | Description | Example | Default |
---|---|---|---|
Parameters | Key-value pairs that will be passed into the Subflow. | Key: response, Value: {{trigger.message.Body}} | N/A |
Parse as JSON object | When passing a parameter, select this option when your parameter contains a JSON object. This allows the variable to be properly interpreted as a JSON object so you can reference its attributes in your flow. When this box is checked, you can: - Set or pass an existing JSON object and reference its members as variables - Set a literal JSON string (using a Liquid reference to a JSON string, or a mixture of JSON and Liquid) and access it as an object Note that by default, subflow parameters are parsed as strings. | N/A | N/A |
These events trigger transitions from this Widget to another Widget in your Flow. For more information on working with Studio transitions, see this guide.
Name | Description |
---|---|
Completed | The Subflow reached the end of its widgets. |
Failed | The Subflow could not be loaded or executed. |
Variables can be returned from the Subflow to the parent Flow using the Set Variables Widget. The variables stored when using a Set Variables Widget in a Subflow are not found in {{flow.variables.<key>}}
after returning from the Subflow. Instead, these variables can be accessed from the Run Subflow Widget.
For example, if you use Set Variables in the Subflow to set foo=bar
, that variable can be referenced in the parent as {{widgets.subflow_widget.foo}}
.
In this case, the Run Subflow Widget is using the Subflow attached to its parent Flow rather than from another Flow.
Now that you know the basics of the Run Subflow Widget, why not learn more about Subflows within Studio?
We can't wait to see what you build!