SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to Build and Trigger Outbound Voice Calls Using Twilio Studio

Objective

Guide developers on the correct architecture for initiating outbound phone calls that run Twilio Studio flows.

 

Product

Studio Flow

 

Objective 

A frequent mistake is placing an outbound call via the Programmable Voice Calls API (POST /2010-04-01/Accounts/{AccountSid}/Calls.json) with the Url parameter pointed to a Studio Flow Webhook URL (https://webhooks.twilio.com/.../Flows/{FlowSid}).

  • Why this fails: Studio webhook URLs expect a call in the ringing state (such as an incoming call). When Voice API places an outbound call, the call is already answered and in-progress when instructions are fetched from Url. Studio cannot bind an execution to an already-answered call via that webhook, returning an HTTP 400 and triggering Error 11200.

Recommended Architecture: Studio Executions REST API

To run an outbound call through Studio, initiate an execution via the Studio REST API and let Studio dial the user via the Make Outgoing Call widget.

Step 1: Configure the Studio Flow

  1. Open the Studio Canvas.
  2. Ensure you have a separate flow for outbound logic if your inbound flow handles incoming caller menus.
  3. Locate the Trigger widget at the top of the canvas.
  4. Drag a Make Outgoing Call widget onto the canvas.
  5. Connect the REST API dot on the Trigger widget to the Make Outgoing Call widget. 
  6. Configure the Make Outgoing Call widget:
    • To: {{flow.data.To}} (or a variable passed via parameters)
    • From: A Twilio number from your account
    • Timeout: Set desired ringing duration (default is 60 seconds).
    • Machine Detection: Configure AMD if required.
  7. Connect the Answered transition of the Make Outgoing Call widget to the rest of your call workflow (e.g., Say/Play, Gather, or Connect Call To).

Step 2: Trigger the Execution via REST API

Initiate the call by creating a new execution rather than placing a direct Voice API call:

curl -X POST "https://studio.twilio.com/v2/Flows/{FlowSid}/Executions" \
  -u {AccountSid}:{AuthToken} \
  --data-urlencode "To=+1234567890" \
  --data-urlencode "From=+1098765432" \
  --data-urlencode "Parameters={\"customParam\":\"value\",\"alertType\":\"CareGiver\"}"
  • To and From: Studio assigns these to the execution context.
  • Parameters: Accepts a JSON-encoded string of key-value pairs, accessible inside the flow as {{flow.data.ParameterKey}}.
Have more questions? Submit a request
Powered by Zendesk