Menu

Expand
Rate this page:

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 Not PII

Boolean if the flow definition is valid.

Validate Flow

post
https://studio.twilio.com/v2/Flows/Validate
Parameters
Parameters in REST API format
friendly_name
Required
post string Not PII

The string that you assigned to describe the Flow.

status
Required
post ienum:status Not PII

The status of the Flow. Can be: draft or published.

definition
Required
post object Not PII

JSON representation of flow definition.

commit_message
Optional
post string Not PII

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.

        Rate this page:

        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.

              
              
              

              Thank you for your feedback!

              Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              Refer us and get $10 in 3 simple steps!

              Step 1

              Get link

              Get a free personal referral link here

              Step 2

              Give $10

              Your user signs up and upgrade using link

              Step 3

              Get $10

              1,250 free SMSes
              OR 1,000 free voice mins
              OR 12,000 chats
              OR more