Twilio Voice

Twilio Voice connects phone calls to workflows. Use this integration to place outbound calls, list calls, retrieve recordings, and receive call events through a webhook. Supply the call instructions and phone numbers required by the selected operation.

Usage Instructions

Integrate Twilio Voice into the workflow. Make outbound calls, redirect or hang up live calls, stream call audio to a voice agent over Media Streams, check a number's line type before dialing, and retrieve call details, recordings, and transcriptions.

Actions

Twilio Voice Make Call

Make an outbound phone call using Twilio Voice API. Run TwiML from a URL or inline, or connect the call audio to a wss:// WebSocket with Media Streams for a live voice agent.

Input

ParameterTypeRequiredDescription
tostringYesPhone number to call in E.164 format (e.g., +14155551234)
fromstringYesYour Twilio phone number to call from in E.164 format (e.g., +14155559876)
urlstringNoWebhook URL that returns TwiML instructions for the call (e.g., https://example.com/twiml)
twimlstringNoTwiML instructions to execute. Use square brackets instead of angle brackets (e.g., [Response][Say]Hello[/Say][/Response])
streamUrlstringNowss:// URL of a WebSocket server to stream the call audio to, both ways. Builds <Connect><Stream> TwiML; use instead of URL or TwiML.
streamParametersjsonNoCustom parameters sent to the WebSocket in the stream start message, as a JSON object (e.g., {"leadId": "123"})
statusCallbackstringNoWebhook URL for call status updates
statusCallbackEventstringNoCall progress events sent to the status callback, separated by spaces or commas: initiated, ringing, answered, completed (default completed)
statusCallbackMethodstringNoHTTP method for status callback (GET or POST)
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token
recordbooleanNoWhether to record the call
recordingStatusCallbackstringNoWebhook URL for recording status updates
timeoutnumberNoTime to wait for answer before giving up (seconds, default: 60)
machineDetectionstringNoAnswering machine detection: Enable or DetectMessageEnd

Output

ParameterTypeDescription
successbooleanWhether the call was successfully initiated
callSidstringUnique identifier for the call
statusstringCall status (queued, ringing, in-progress, completed, etc.)
directionstringCall direction (outbound-api)
fromstringPhone number the call is from
tostringPhone number the call is to
durationnumberCall duration in seconds
pricestringCost of the call
priceUnitstringCurrency of the price
errorstringError message if call failed

Twilio Voice List Calls

Retrieve a list of calls made to and from an account.

Input

ParameterTypeRequiredDescription
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token
tostringNoFilter by calls to this phone number in E.164 format (e.g., +14155551234)
fromstringNoFilter by calls from this phone number in E.164 format (e.g., +14155559876)
statusstringNoFilter by call status (e.g., queued, ringing, in-progress, completed, busy, failed, no-answer, canceled)
startTimeAfterstringNoFilter calls that started on or after this date (YYYY-MM-DD)
startTimeBeforestringNoFilter calls that started on or before this date (YYYY-MM-DD)
pageSizenumberNoNumber of records to return (max 1000, default 50)

Output

ParameterTypeDescription
successbooleanWhether the calls were successfully retrieved
callsarrayArray of call objects
totalnumberTotal number of calls returned
pagenumberCurrent page number
pageSizenumberNumber of calls per page
errorstringError message if retrieval failed

Twilio Voice Get Recording

Retrieve call recording information and transcription (if enabled via TwiML).

Input

ParameterTypeRequiredDescription
recordingSidstringYesRecording SID to retrieve (e.g., RExxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token

Output

ParameterTypeDescription
successbooleanWhether the recording was successfully retrieved
recordingSidstringUnique identifier for the recording
callSidstringCall SID this recording belongs to
durationnumberDuration of the recording in seconds
statusstringRecording status (completed, processing, etc.)
channelsnumberNumber of channels (1 for mono, 2 for dual)
sourcestringHow the recording was created
mediaUrlstringURL to download the recording media file
filefileDownloaded recording media file
pricestringCost of the recording
priceUnitstringCurrency of the price
uristringRelative URI of the recording resource
transcriptionTextstringTranscribed text from the recording (if available)
transcriptionStatusstringTranscription status (completed, in-progress, failed)
transcriptionPricestringCost of the transcription
transcriptionPriceUnitstringCurrency of the transcription price
errorstringError message if retrieval failed

Twilio Voice Get Call

Get one call by SID: its status, numbers, start and end time, duration, price, and answering machine detection result.

Input

ParameterTypeRequiredDescription
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token
callSidstringYesSID of the call to fetch (starts with CA)

Output

ParameterTypeDescription
successbooleanOperation success status
callSidstringCall unique identifier
statusstringCall or recording status
directionstringCall direction
durationnumberCall/recording duration in seconds
pricestringCost of the operation
priceUnitstringCurrency of the price
recordingSidstringRecording unique identifier
channelsnumberNumber of recording channels
sourcestringRecording source
mediaUrlstringURL to download recording
uristringResource URI
transcriptionTextstringTranscribed text (only if TwiML includes <Record transcribe="true">)
transcriptionStatusstringTranscription status (completed, in-progress, failed)
callsarrayArray of call objects (for list_calls operation)
totalnumberTotal number of calls returned
pagenumberCurrent page number
pageSizenumberNumber of calls per page
errorstringError message if operation failed
accountSidstringTwilio Account SID from webhook
fromstringCaller's phone number (E.164 format)
tostringRecipient phone number (your Twilio number)
callStatusstringStatus of the incoming call (queued, ringing, in-progress, completed, etc.)
apiVersionstringTwilio API version
callerNamestringCaller ID name if available
forwardedFromstringPhone number that forwarded this call
digitsstringDTMF digits entered by caller (from <Gather>)
speechResultstringSpeech recognition result (if using <Gather>)
recordingUrlstringURL of call recording if available
rawstringComplete raw webhook payload as JSON string
parentCallSidstringSID of the call that created this leg
toFormattedstringCalled number, formatted for display
fromFormattedstringCaller number, formatted for display
phoneNumberSidstringSID of the Twilio number used
startTimestringWhen the call was answered
endTimestringWhen the call ended
answeredBystringAnswering machine detection result
queueTimenumberMilliseconds the call waited in queue
dateCreatedstringWhen the resource was created
dateUpdatedstringWhen the resource was last updated
recordingsarrayRecordings on this page, newest first (List Recordings)
countnumberNumber of recordings on this page
nextPageTokenstringPage token for the next page
nextPagenumberPage index for the next page
nextPageUristringRelative URI of the next page
conferenceSidstringConference SID of a recording
errorCodenumberError code of a failed recording
transcriptionSidstringTranscription SID
typestringTranscription type
phoneNumberstringLooked-up number in E.164 format
nationalFormatstringNumber in national format
countryCodestringISO country code of the number
callingCountryCodestringInternational dialing prefix
validbooleanWhether the number is valid
validationErrorsarrayReasons the number is invalid
lineTypestringLine type: mobile, landline, fixedVoip, nonFixedVoip, tollFree, ...
isLandlinebooleanTrue when the line type is landline
isMobilebooleanTrue when the line type is mobile
carrierNamestringCarrier name
mobileCountryCodestringMobile country code of the carrier
mobileNetworkCodestringMobile network code of the carrier
lineTypeErrorCodenumberLine type lookup error code
callerTypestringBUSINESS or CONSUMER (US only)
callerNameErrorCodenumberCaller name lookup error code

Twilio Voice Update Call

Change a live call: redirect it to a new TwiML URL or inline TwiML, connect its audio to a WebSocket with Media Streams (wss://), or end it with status completed or canceled.

Input

ParameterTypeRequiredDescription
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token
callSidstringYesSID of the live call to update (starts with CA)
urlstringNoAbsolute URL that returns the TwiML the call should run next
methodstringNoHTTP method Twilio uses to fetch the TwiML URL: GET or POST (default POST)
twimlstringNoTwiML the call should run next (max 4000 characters). Square brackets work in place of angle brackets (e.g., [Response][Say]Hello[/Say][/Response]).
streamUrlstringNowss:// URL of a WebSocket server to stream the call audio to, both ways. Builds <Connect><Stream> TwiML; use instead of TwiML URL or TwiML.
streamParametersjsonNoCustom parameters sent to the WebSocket in the stream start message, as a JSON object (e.g., {"leadId": "123"})
statusstringNoEnd the call: completed (hangs up any call) or canceled (only cancels a queued or ringing call)
fallbackUrlstringNoURL Twilio requests if fetching or running the TwiML URL fails
statusCallbackstringNoURL for call status updates. Twilio only applies it together with a TwiML URL.
statusCallbackMethodstringNoHTTP method for the status callback: GET or POST (default POST)
timeLimitnumberNoMaximum call duration in seconds

Output

ParameterTypeDescription
successbooleanOperation success status
callSidstringCall unique identifier
statusstringCall or recording status
directionstringCall direction
durationnumberCall/recording duration in seconds
pricestringCost of the operation
priceUnitstringCurrency of the price
recordingSidstringRecording unique identifier
channelsnumberNumber of recording channels
sourcestringRecording source
mediaUrlstringURL to download recording
uristringResource URI
transcriptionTextstringTranscribed text (only if TwiML includes <Record transcribe="true">)
transcriptionStatusstringTranscription status (completed, in-progress, failed)
callsarrayArray of call objects (for list_calls operation)
totalnumberTotal number of calls returned
pagenumberCurrent page number
pageSizenumberNumber of calls per page
errorstringError message if operation failed
accountSidstringTwilio Account SID from webhook
fromstringCaller's phone number (E.164 format)
tostringRecipient phone number (your Twilio number)
callStatusstringStatus of the incoming call (queued, ringing, in-progress, completed, etc.)
apiVersionstringTwilio API version
callerNamestringCaller ID name if available
forwardedFromstringPhone number that forwarded this call
digitsstringDTMF digits entered by caller (from <Gather>)
speechResultstringSpeech recognition result (if using <Gather>)
recordingUrlstringURL of call recording if available
rawstringComplete raw webhook payload as JSON string
parentCallSidstringSID of the call that created this leg
toFormattedstringCalled number, formatted for display
fromFormattedstringCaller number, formatted for display
phoneNumberSidstringSID of the Twilio number used
startTimestringWhen the call was answered
endTimestringWhen the call ended
answeredBystringAnswering machine detection result
queueTimenumberMilliseconds the call waited in queue
dateCreatedstringWhen the resource was created
dateUpdatedstringWhen the resource was last updated
recordingsarrayRecordings on this page, newest first (List Recordings)
countnumberNumber of recordings on this page
nextPageTokenstringPage token for the next page
nextPagenumberPage index for the next page
nextPageUristringRelative URI of the next page
conferenceSidstringConference SID of a recording
errorCodenumberError code of a failed recording
transcriptionSidstringTranscription SID
typestringTranscription type
phoneNumberstringLooked-up number in E.164 format
nationalFormatstringNumber in national format
countryCodestringISO country code of the number
callingCountryCodestringInternational dialing prefix
validbooleanWhether the number is valid
validationErrorsarrayReasons the number is invalid
lineTypestringLine type: mobile, landline, fixedVoip, nonFixedVoip, tollFree, ...
isLandlinebooleanTrue when the line type is landline
isMobilebooleanTrue when the line type is mobile
carrierNamestringCarrier name
mobileCountryCodestringMobile country code of the carrier
mobileNetworkCodestringMobile network code of the carrier
lineTypeErrorCodenumberLine type lookup error code
callerTypestringBUSINESS or CONSUMER (US only)
callerNameErrorCodenumberCaller name lookup error code

Twilio Voice Hang Up Call

End a live call by setting its status to completed. Works for queued, ringing, and in-progress calls, including a parent call running a Dial.

Input

ParameterTypeRequiredDescription
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token
callSidstringYesSID of the call to end (starts with CA)

Output

ParameterTypeDescription
successbooleanOperation success status
callSidstringCall unique identifier
statusstringCall or recording status
directionstringCall direction
durationnumberCall/recording duration in seconds
pricestringCost of the operation
priceUnitstringCurrency of the price
recordingSidstringRecording unique identifier
channelsnumberNumber of recording channels
sourcestringRecording source
mediaUrlstringURL to download recording
uristringResource URI
transcriptionTextstringTranscribed text (only if TwiML includes <Record transcribe="true">)
transcriptionStatusstringTranscription status (completed, in-progress, failed)
callsarrayArray of call objects (for list_calls operation)
totalnumberTotal number of calls returned
pagenumberCurrent page number
pageSizenumberNumber of calls per page
errorstringError message if operation failed
accountSidstringTwilio Account SID from webhook
fromstringCaller's phone number (E.164 format)
tostringRecipient phone number (your Twilio number)
callStatusstringStatus of the incoming call (queued, ringing, in-progress, completed, etc.)
apiVersionstringTwilio API version
callerNamestringCaller ID name if available
forwardedFromstringPhone number that forwarded this call
digitsstringDTMF digits entered by caller (from <Gather>)
speechResultstringSpeech recognition result (if using <Gather>)
recordingUrlstringURL of call recording if available
rawstringComplete raw webhook payload as JSON string
parentCallSidstringSID of the call that created this leg
toFormattedstringCalled number, formatted for display
fromFormattedstringCaller number, formatted for display
phoneNumberSidstringSID of the Twilio number used
startTimestringWhen the call was answered
endTimestringWhen the call ended
answeredBystringAnswering machine detection result
queueTimenumberMilliseconds the call waited in queue
dateCreatedstringWhen the resource was created
dateUpdatedstringWhen the resource was last updated
recordingsarrayRecordings on this page, newest first (List Recordings)
countnumberNumber of recordings on this page
nextPageTokenstringPage token for the next page
nextPagenumberPage index for the next page
nextPageUristringRelative URI of the next page
conferenceSidstringConference SID of a recording
errorCodenumberError code of a failed recording
transcriptionSidstringTranscription SID
typestringTranscription type
phoneNumberstringLooked-up number in E.164 format
nationalFormatstringNumber in national format
countryCodestringISO country code of the number
callingCountryCodestringInternational dialing prefix
validbooleanWhether the number is valid
validationErrorsarrayReasons the number is invalid
lineTypestringLine type: mobile, landline, fixedVoip, nonFixedVoip, tollFree, ...
isLandlinebooleanTrue when the line type is landline
isMobilebooleanTrue when the line type is mobile
carrierNamestringCarrier name
mobileCountryCodestringMobile country code of the carrier
mobileNetworkCodestringMobile network code of the carrier
lineTypeErrorCodenumberLine type lookup error code
callerTypestringBUSINESS or CONSUMER (US only)
callerNameErrorCodenumberCaller name lookup error code

Twilio Voice List Recordings

List call recordings on the account, newest first, optionally for one call or a creation date range, with paging.

Input

ParameterTypeRequiredDescription
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token
callSidstringNoOnly recordings of this call (starts with CA)
dateCreatedstringNoOnly recordings created on this date (YYYY-MM-DD, GMT)
dateCreatedAfterstringNoOnly recordings created on or after this date (YYYY-MM-DD, GMT)
dateCreatedBeforestringNoOnly recordings created on or before this date (YYYY-MM-DD, GMT)
pageSizenumberNoNumber of records per page (1 to 1000, default 50)
pagenumberNoPage index to request; pass the nextPage value from a previous call
pageTokenstringNoPage token to request; pass the nextPageToken value from a previous call

Output

ParameterTypeDescription
recordingsarrayRecordings on this page, newest first
countnumberNumber of recordings on this page

Twilio Voice Get Transcription

Get the text of a recording transcription by SID, created by <Record transcribe="true">. Twilio has deprecated Recording Transcriptions in favor of its newer transcription products.

Input

ParameterTypeRequiredDescription
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token
transcriptionSidstringYesSID of the transcription to fetch (starts with TR)

Output

ParameterTypeDescription
transcriptionSidstringTranscription SID (starts with TR)
recordingSidstringSID of the recording that was transcribed
statusstringTranscription status: in-progress, completed, or failed
transcriptionTextstringTranscribed text, once the status is completed
durationnumberLength of the transcribed audio in seconds
pricestringAmount billed for the transcription
priceUnitstringCurrency of the price (ISO 4217)
typestringTranscription type
dateCreatedstringWhen the transcription was created (RFC 2822)
dateUpdatedstringWhen the transcription was last updated (RFC 2822)

Twilio Lookup Phone Number

Validate and format a phone number with Twilio Lookup v2, and optionally get its line type (mobile, landline, VoIP), carrier, and US caller name. Use the line type to skip landlines before placing AI calls or sending SMS. Line type and caller name are paid Lookup packages.

Input

ParameterTypeRequiredDescription
accountSidstringYesTwilio Account SID
authTokenstringYesTwilio Auth Token
phoneNumberstringYesPhone number to look up, in E.164 format (e.g., +14155552671) or national format with Country Code
fieldsstringNoComma-separated Lookup data packages: line_type_intelligence (paid), caller_name (paid, US only), validation. Leave empty for free basic validation and formatting only.
countryCodestringNoISO 3166-1 alpha-2 country code used when the number is in national format (default US)

Output

ParameterTypeDescription
phoneNumberstringNumber in E.164 format
nationalFormatstringNumber in national format
countryCodestringISO 3166-1 alpha-2 country code of the number
callingCountryCodestringInternational dialing prefix
validbooleanWhether the number is a valid phone number
validationErrorsarrayReasons the number is invalid (e.g., TOO_SHORT, INVALID_COUNTRY_CODE)
lineTypestringLine type from line_type_intelligence: landline, mobile, fixedVoip, nonFixedVoip, personal, tollFree, premium, sharedCost, uan, voicemail, pager, or unknown
isLandlinebooleanTrue when the line type is landline; null when line type was not requested
isMobilebooleanTrue when the line type is mobile; null when line type was not requested
carrierNamestringName of the carrier
mobileCountryCodestringThree-digit mobile country code of the carrier
mobileNetworkCodestringMobile network code of the carrier (mobile numbers only)
lineTypeErrorCodenumberError code for the line type lookup, if it failed
callerNamestringName of the number owner (US carriers only)
callerTypestringBUSINESS or CONSUMER (US carriers only)
callerNameErrorCodenumberError code for the caller name lookup, if it failed

Triggers

A Trigger is a block that starts a workflow when an event happens in this service.

Twilio Voice Webhook

Trigger workflow when a phone call is received via Twilio Voice, or when a call you placed reports a status change (status callback)

Configuration

ParameterTypeRequiredDescription
accountSidstringYesYour Twilio Account SID from the Twilio Console
authTokenstringYesYour Twilio Auth Token for webhook signature verification
twimlResponsestringNoTwiML instructions to return immediately to Twilio. Use square brackets instead of angle brackets (e.g., [Response] instead of <Response>). This controls what happens when the call comes in (e.g., play a message, record, gather input). Your workflow will execute in the background.

Output

ParameterTypeDescription
callSidstringUnique identifier for this call
accountSidstringTwilio Account SID
fromstringCaller's phone number (E.164 format)
tostringRecipient phone number (your Twilio number)
callStatusstringStatus of the call (queued, ringing, in-progress, completed, etc.)
directionstringCall direction: inbound or outbound
apiVersionstringTwilio API version
callerNamestringCaller ID name if available
forwardedFromstringPhone number that forwarded this call
digitsstringDTMF digits entered by caller (from <Gather>)
speechResultstringSpeech recognition result (if using <Gather> with speech)
recordingUrlstringURL of call recording if available
recordingSidstringRecording SID if available
calledstringPhone number that was called (same as "to")
callerstringPhone number of the caller (same as "from")
toCitystringCity of the called number
toStatestringState/province of the called number
toZipstringZip/postal code of the called number
toCountrystringCountry of the called number
fromCitystringCity of the caller
fromStatestringState/province of the caller
fromZipstringZip/postal code of the caller
fromCountrystringCountry of the caller
calledCitystringCity of the called number (same as toCity)
calledStatestringState of the called number (same as toState)
calledZipstringZip code of the called number (same as toZip)
calledCountrystringCountry of the called number (same as toCountry)
callerCitystringCity of the caller (same as fromCity)
callerStatestringState of the caller (same as fromState)
callerZipstringZip code of the caller (same as fromZip)
callerCountrystringCountry of the caller (same as fromCountry)
callTokenstringTwilio call token for authentication
parentCallSidstringSID of the call that created this call leg, if any
callDurationstringCall length in seconds, on terminal status callbacks (completed, busy, failed, no-answer, canceled)
durationstringBilled call length in minutes, on the completed status callback
sipResponseCodestringSIP response code of the call, on terminal status callbacks
timestampstringWhen the status callback event fired (UTC, RFC 2822)
callbackSourcestringSource of a status callback (call-progress-events)
sequenceNumberstringOrder of this status callback among the events of the call, starting at 0
answeredBystringAnswering machine detection result when detection is enabled: human, machine_start, machine_end_beep, machine_end_silence, machine_end_other, fax, or unknown
machineDetectionDurationstringMilliseconds answering machine detection took, on async detection callbacks
recordingDurationstringRecording length in seconds, when a recording is attached
recordingStatusstringRecording status on recording status callbacks (in-progress, completed, absent)
stirStatusstringSTIR/SHAKEN attestation of the call, when Twilio provides it
rawstringComplete raw webhook payload from Twilio as JSON string