Flow Validate
The Flow Validate endpoint will validate a Flow definition without creating a new Flow. It accepts the same parameters as the Create Flow method and returns {"valid":true}
in the response payload if no errors were found; otherwise, if the definition fails validation, the endpoint returns an error response.
FlowValidate properties
Resource Properties in REST API format | |
---|---|
valid
|
Boolean if the flow definition is valid. |
Validate Flow
https://studio.twilio.com/v2/Flows/Validate
Parameters
Parameters in REST API format | |
---|---|
friendly_name
Required
|
The string that you assigned to describe the Flow. |
status
Required
|
The status of the Flow. Can be: |
definition
Required
|
JSON representation of flow definition. |
commit_message
Optional
|
Description of change made in the revision. |
Example 1
Troubleshoot using error details
An error response will be returned if the given Flow definition fails validation. Use the details
object in the error response to find all errors present within the definition. Each error contains a message along with the path of where the issue took place.
For example, the initial_state
parameter for this Flow definition has been changed to an invalid value:
client.studio.v2.flowValidate
.update({
friendlyName: 'Test Flow',
status: 'published',
definition: {
description: 'A New Flow',
flags: {
allow_concurrent_calls: true
},
initial_state: 'test', // changed from Trigger -> test for demonstration
states: [
{
name: 'Trigger',
properties: {
offset: {
x: 0,
y: 0
}
},
transitions: [
],
type: 'trigger'
}
]
}
})
.then(flow_validate => console.log(flow_validate))
.catch(e => console.log(e.details));
If an error response is delivered, the details will be logged to console. After the API request is made, the console logs this information:
{
errors: [
{
message: 'must match a widget name',
property_path: '#/initial_state'
}
],
warnings: []
}
The message indicates that the name must be a valid Widget name. This property is located at #/initial_state
, which was where the invalid value was inputted for this example.
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.