To represent the complex structure and requirements of a Studio Flow and its widget configurations, the Flow definition is expressed as a JSON schema. Thus, when creating or updating Flows via the REST API, the JSON sent in the
Definition parameter must pass validation against that schema.
Below are sample Flow and widget definitions you can copy and paste into your application. Alternatively, use the Studio editor in Twilio Console to automatically create valid definitions and export them from the API to save them locally or to add them to version control. Refer to the JSON schemas for full details of widgets and properties.
The following sample definitions can be used as standalone starters for your application. Include the complete JSON as the
Definition parameter in your POST to the API.
Widgets are defined as "states" that the Studio workflow engine transitions to in response to events. The following JSON snippets can be used to add individual widgets as
states to an existing Flow definition.
Add each widget snippet as a new item in the
// ADD WIDGET SNIPPETS HERE
"description": "A New Flow"