This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Twilio Connector
The Twilio connector allows you to connect to Twilio, an online service that lets you embed phones, VoIP, and messaging in web, desktop, and mobile software. The connector uses the Twilio REST API to connect to Twilio and work with accounts, applications, calls, messages, and more. The underlying Java classes in the connector use the Twilio Java Helper Library to make the HTTP requests to the Twilio API.
The following sections describe how to perform various operations with the connector. For general information on using connectors and their operations in your ESB configurations, see Using a Connector. To download the connector, go to https://store.wso2.com/store/assets/esbconnector/twilio, click the Twilio connector, and then click Download Connector. Then you can add and enable the connector in your ESB instance.
Connecting to Twilio
To use the Twilio connector, add the <twilio.init>
element in your configuration before any other Twilio operations. This Twilio configuration authenticates with Twilio by specifying the SID and authentication token of your master Twilio account. You can find your SID and token by logging into your Twilio account and going to the API Credentials section on the dashboard.
<twilio.init> <accountSid>ACba8bc05eacf94afdae398e642c9cc32d</accountSid> <authToken>AC5ef8732a3c49700934481addd5ce1659:{AuthToken}</authToken> </twilio.init>
Entering secure data
For security purposes, you should store your SID and token in the WSO2 secure vault and reference it by alias instead of hard-coding the actual values in the configuration file. For more information, see Working with Passwords.
Re-using Twilio configurations
For best results, save the Twilio configuration as a local entry. You can then easily reference it with the configKey
attribute in your Twilio operations. For example, if you saved the above <twilio.init>
entry as a local entry named MyTwilioConfig, you could reference it from an operation like getTranscriptionList
as follows:
<twilio.getTranscriptionList configKey="MyTwilioConfig" />
Working with accounts
The following operations are available for working with accounts:
Operation | Description |
---|---|
createSubAccount | Creates a new account resource as a sub-account of the master account. |
getAccountsList | Retrieves a list of the account resources belonging to the master account. This list will include the master account as well. |
getAccount | Returns a representation of a specified account. |
updateAccount | Allows you to modify the properties of an account. |
Following is more information about these operations.
Creating a sub-account
<twilio.createSubAccount configKey="MyTwilioConfig"> <friendlyName>My New Account</friendlyName> </twilio.createSubAccount>
To create a sub-account as a resource of the master account, use twilio.createSubAccount
and specify the following properties. If successful, Twilio responds with information about the sub-account, including its SID, a 34-character string that uniquely identifies this sub-account.
Properties
friendlyName
: A human-readable description of the new sub-account, up to 64 characters. Defaults to "SubAccount Created at {YYYY-MM-DD HH:MM meridian}".
Related Twilio documentation
http://www.twilio.com/docs/api/rest/subaccounts
Getting a list of accounts
<twilio.getAccountsList configKey="MyTwilioConfig"> <friendlyName>My SubAccount</friendlyName> <status>active</status> </twilio.getAccountsList>
To get a list of existing accounts that belong to the master account, use twilio.getAccountsList
and optionally specify the following properties. If you do not specify these properties, all accounts belong to the master account are returned. The master account is included in the list.
Properties
friendlyName
: Optional. The human-readable account name. Only accounts whose name exactly match this string are returned.status
: Optional. The status of accounts to return: active, suspended, or closed. Only accounts with this status are returned.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/account#list
Getting a specific account
<twilio.getAccount configKey="MyTwilioConfig"> <subAccountSid>ACba8bc05eacf94afdae398e642c9cc32d</subAccountSid> </twilio.getAccount>
To get information about an account, such as its friendly name, date created, and status, use twilio.getAccount
and specify the following properties.
Properties
subAccountSid
: The ID of the account you want to retrieve.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/account
Updating an account
<twilio.updateAccount configKey="MyTwilioConfig"> <subAccountSid>ACba8bc05eacf94afdae398e642c9cc32d</subAccountSid> <friendlyName>MySubAccount</friendlyName> <status>suspended</status> </twilio.updateAccount>
To update an account's friendly name and/or status, use twilio.updateAccount
and specify the following properties.
Properties
subAccountSid
: The ID of the account you want to update.friendlyName
: Optional. The new human-readable name to give the account.status
: Optional. The new status of the account: active, suspended, or closed.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/account
Working with applications
The following operations are available for working with applications and Connect Apps in your Twilio account:
Operation | Description |
---|---|
createApplication | Creates a new application. |
getApplicationList | Retrieves a list of all the applications you've created in the master account. |
getApplication | Returns information about a specific application. |
getConnectAppList | Retrieves a list of all the Connect Apps you've created in the master account. |
getConnectApp | Returns information about a specific Connect App. |
getAuthorizedConnectAppList | Retrieves a list of the Connect Apps that are authorized to access your account. |
getAuthorizedConnectApp | Returns information about a specific authorized Connect App. |
updateApplication | Updates the properties of an application. |
updateConnectApp | Updates the properties of a Connect App. |
removeApplication | Deletes an application. If this application's SID is assigned to any IncomingPhoneNumber resources as a VoiceApplicationSid or SmsApplicationSid, it will be removed from those resources. |
Following is more information about these operations.
Creating an application
<twilio.createApplication configKey="MyTwilioConfig"> <friendlyName>Phone Me</friendlyName> <apiVersion>2010-04-01</apiVersion> <voiceUrl>http://demo.twilio.com/docs/voice.xml</voiceUrl> <voiceMethod>POST</voiceMethod> <voiceFallbackUrl>http://demo.twilio.com/docs/voicefallback.xml</voiceFallbackUrl> <voiceFallbackMethod>POST</voiceFallbackMethod> <statusCallback>http://demo.twilio.com/docs/statuscallback.xml</statusCallback> <statusCallbackMethod>POST</statusCallbackMethod> <voiceCallerIdLookup>false</voiceCallerIdLookup> <smsUrl>http://demo.twilio.com/docs/sms.xml</smsUrl> <smsMethod>POST</smsMethod> <smsFallbackUrl>http://demo.twilio.com/docs/smsfallback.xml</smsFallbackUrl> <smsFallbackMethod>POST</smsFallbackMethod> <smsStatusCallback>http://demo.twilio.com/docs/smsstatuscallback.xml</smsStatusCallback> </twilio.createApplication>
To create an application in the master account, use twilio.createApplication
and specify the following properties. If successful, Twilio responds with a representation of the application, including its SID, a 34-character string that uniquely identifies this application. You must specify voiceUrl
or smsUrl
or both.
Properties
friendlyName
: The human-readable name to give the application, up to 64 characters.apiVersion
: Optional. Specifies the API version, either 2010-04-01 or 2008-08-01, to use when requests to the application's URLs are received. Defaults to your account's default API version.voiceUrl
: Optional. The URL that Twilio should request when somebody dials a phone number assigned to this application. Not required if your application does not support voice.voiceMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the voice URL. Defaults to POST.voiceFallbackUrl
: Optional. A URL that Twilio will request if an error occurs when requests are made to the voice URL.voiceFallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the voice fallback URL. Defaults to POST.statusCallback
: Optional. The URL that Twilio will request to pass status parameters (such as call ended) to your application.statusCallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the status callback URL. Defaults to POST.voiceCallerIdLookup
: Optional. If true, performs a lookup of the caller's name from the CNAM database and posts it to your app. Defaults to false.smsUrl
: Optional. The URL that Twilio should request when somebody sends an SMS to a phone number assigned to this application. Not required if your application does not support SMS.smsMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the SMS URL. Defaults to POST.smsFallbackUrl
: Optional. The URL that Twilio will request if an error occurs when requests are made to the SMS URL.smsFallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the SMS fallback URL. Defaults to POST.smsStatusCallback
: Optional. Twilio will make a POST request to this URL to pass status parameters (such as sent or failed) to your application if you specify this application's SID as theApplicationSid
on an outgoing SMS request.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/applications
Getting a list of applications
<twilio.getApplicationList configKey="MyTwilioConfig"> <friendlyName>Phone Me</friendlyName> </twilio.getApplicationList>
To get a list of the applications in the master account, use twilio.getApplicationList
and specify the following properties.
Properties
friendlyName
: Optional. The human-readable application name. Only applications whose name exactly match this string are returned.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/applications
Getting a specific application
<twilio.getApplication configKey="MyTwilioConfig"> <applicationSid>AP2a0747eba6abf96b7e3c3ff0b4530f6e</applicationSid> </twilio.getApplication>
To get a specific application from the master account, use twilio.getApplication
and specify the following properties.
Properties
applicationSid
: The 32-character string that uniquely identifies the account.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/applications
Getting a list of Connect Apps
<twilio.getConnectAppList configKey="MyTwilioConfig />
To get a list of the Connect Apps created in the master account, including the permissions each Connect App will request from users, use twilio.getConnectAppList
.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/connect-apps
Getting a specific Connect App
<twilio.getConnectApp configKey="MyTwilioConfig"> <connectAppSid>CNb989fdd207b04d16aee578018ef5fd93</connectAppSid> </twilio.getConnectApp>
To get the properties of a specific Connect App, use twilio.getConnectApp
and specify the following properties.
Properties
connectAppSid
: SID of the Connect App.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/connect-apps
Getting a list of authorized Connect Apps
<twilio.getAuthorizedConnectAppList configKey="MyTwilioConfig />
To get a list of the Connect Apps that are authorized for your account, use twilio.getAuthorizedConnectAppList
.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/authorized-connect-apps
Getting a specific authorized Connect App
<twilio.getAuthorizedConnectApp configKey="MyTwilioConfig"> <authorizedConnectAppSid>AC5ef872f6da5a21de157d80997a64bd33</authorizedConnectAppSid> </twilio.getAuthorizedConnectApp>
To get the properties of a specific authorized Connect App, including the permissions you have granted it, use twilio.getAuthorizedConnectApp
and specify the following properties.
Properties
authorizedConnectAppSid
: SID of the authorized Connect App.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/connect-apps
Updating an application
<twilio.updateApplication configKey="MyTwilioConfig"> <applicationSid>AP2a0747eba6abf96b7e3c3ff0b4530f6e</applicationSid> <friendlyName>Phone Me</friendlyName> <apiVersion>2010-04-01</apiVersion> <voiceUrl>http://demo.twilio.com/docs/voice.xml</voiceUrl> <voiceMethod>POST</voiceMethod> <voiceFallbackUrl>http://demo.twilio.com/docs/voicefallback.xml</voiceFallbackUrl> <voiceFallbackMethod>POST</voiceFallbackMethod> <statusCallback>http://demo.twilio.com/docs/statuscallback.xml</statusCallback> <statusCallbackMethod>POST</statusCallbackMethod> <voiceCallerIdLookup>false</voiceCallerIdLookup> <smsUrl>http://demo.twilio.com/docs/sms.xml</smsUrl> <smsMethod>POST</smsMethod> <smsFallbackUrl>http://demo.twilio.com/docs/smsfallback.xml</smsFallbackUrl> <smsFallbackMethod>POST</smsFallbackMethod> <smsStatusCallback>http://demo.twilio.com/docs/smsstatuscallback.xml</smsStatusCallback> </twilio.updateApplication>
To update the properties of an application, use twilio.updateApplication
, specify the application's SID, and then specify the properties you want to update. If successful, Twilio responds with a representation of the application.
Properties
applicationSid
: The SID of the application you are updating.friendlyName
: Optional. The human-readable name of the application, up to 64 characters.apiVersion
: Optional. Specifies the API version, either 2010-04-01 or 2008-08-01, to use when requests to the application's URLs are received. Defaults to your account's default API version.voiceUrl
: The URL that Twilio should request when somebody dials a phone number assigned to this application. Not required if your application does not support voice.voiceMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the voice URL. Defaults to POST.voiceFallbackUrl
: Optional. A URL that Twilio will request if an error occurs when requests are made to the voice URL.voiceFallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the voice fallback URL. Defaults to POST.statusCallback
: Optional. The URL that Twilio will request to pass status parameters (such as call ended) to your application.statusCallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the status callback URL. Defaults to POST.voiceCallerIdLookup
: Optional. If true, performs a lookup of the caller's name from the CNAM database and posts it to your app. Defaults to false.smsUrl
: The URL that Twilio should request when somebody sends an SMS to a phone number assigned to this application. Not required if your application does not support SMS.smsMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the SMS URL. Defaults to POST.smsFallbackUrl
: Optional. The URL that Twilio will request if an error occurs when requests are made to the SMS URL.smsFallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the SMS fallback URL. Defaults to POST.smsStatusCallback
: Optional. Twilio will make a POST request to this URL to pass status parameters (such as sent or failed) to your application if you specify this application's SID as theApplicationSid
on an outgoing SMS request.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/applications
Updating a Connect App
<twilio.updateConnectApp configKey="MyTwilioConfig"> <connectAppSid>CNb989fdd207b04d16aee578018ef5fd93</connectAppSid> <friendlyName>My Connect App</friendlyName> <authorizeCallbackUrl>https://www.mycompany.com/connect_authorize</authorizeCallbackUrl> <deauthorizeRedirectUrl>https://www.mycompany.com/connect_deauthorize</deauthorizeRedirectUrl> <deauthorizeCallbackMethod>POST</deauthorizeCallbackMethod> <permissions>get-all,post-all</permissions> <description>Connects to my company's Twilio account</description> <companyName>My Company</companyName> <homepageUrl>http://www.mycompany.com</homepageUrl> </twilio.updateConnectApp>
To update the properties of a Connect App, use twilio.updateConnectApp
, specify the Connect Apps' SID, and then specify the properties you want to update. If successful, Twilio responds with a representation of the application.
Properties
connectAppSid
: The SID of the Connect App you are updating.friendlyName
: Optional. The human-readable name of the Connect App, up to 64 characters.authorizeCallbackUrl
: Optional. The URL the user's browser will redirect to after Twilio authenticates the user and obtains authorization for this Connect App.deauthorizeRedirectUrl
: The URL to which Twilio will send a request when a user de-authorizes this Connect App.deauthorizeCallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the deauthorize callback URL.permissions
: Optional. A comma-separated list of the permissions you will request from users of this Connect App. Valid permissions areget-all
andpost-all
.description
: Optional. A more detailed human-readable description of this Connect App,.companyName
: Optional. The company name for this Connect App.homepageUrl
: Optional. The public URL where users can obtain more information about this Connect App.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/connect-apps
Removing an application
<twilio.removeApplication configKey="MyTwilioConfig"> <applicationSid>AP2a0747eba6abf96b7e3c3ff0b4530f6e</applicationSid> </twilio.removeApplication>
To remove an application from the master account, use twilio.removeApplication
and specify the following properties.
Properties
applicationSid
: The SID of the application you are removing.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/applications
Working with calls
The following operations are available for working with calls, recordings, and transcriptions.
Operation | Description |
---|---|
makeCall | Makes an outgoing call to a phone, SIP-enabled endpoint, or Twilio Client connection. Calls are rate-limited to one per second. You can queue up as many calls as you like as fast as you like, but each call is processed off the queue at a rate of one per second. |
getCallList | Returns a list of calls made to and from your account. |
getCall | Retrieves information about a specific call. |
modifyLiveCall | Changes the behavior of an in-progress call, such as transferring the call, playing hold music, or terminating the call. |
getRecordingList | Returns a list of recordings in your account. |
getRecording | Retrieves a specific recording. |
deleteRecording | Deletes a recording. |
getTranscriptionList | Returns a list of transcriptions of recordings in your account. |
getTranscription | Retrieves a specific transcription of a recording. |
Following is more information about these operations.
Making a call
<twilio.makeCall configKey="MyTwilioConfig"> <to>%2B14155551212</to> <from>%2B18668675309</from> <url>http://demo.twilio.com/docs/voice.xml</url> <method>POST</method> <fallbackUrl>http://demo.twilio.com/docs/voicefallback.xml</fallbackUrl> <fallbackMethod>POST</fallbackMethod> <statusCallback>http://demo.twilio.com/docs/statuscallback.xml</statusCallback> <statusCallbackMethod>GET</statusCallbackMethod> <sendDigits>ww1234%23</sendDigits> <ifMachine>Continue</ifMachine> <timeout>60</timeout> <record>false</record> </twilio.makeCall>
To make a call, use twilio.makeCall
and specify the following properties. For more information on formatting phone numbers, see http://www.twilio.com/docs/api/rest/making-calls#post-parameters-required.
Properties
to
: The phone number, SIP address, or client identifier to call. For more information on SIP, see http://www.twilio.com/docs/sip.from
: The phone number or client identifier to use as the caller ID. If using a phone number, it must be a Twilio number or a verified outgoing caller ID for your account.applicationSid
: The 34-character string that uniquely identifies the application that defines the properties to use for making the call. If you use this property, the following voice properties will be ignored, because they are already defined by the application:url
,method
,fallbackUrl
,fallbackMethod
,statusCallback
, andstatusCallbackMethod
.url
: The fully qualified URL that should be consulted when the call connects. This property is ignored if you specify anapplicationSid
.method
: Optional. The HTTP method, GET or POST, to use when connecting to the URL. Defaults to POST. This property is ignored if you specify anapplicationSid
.fallbackUrl
: Optional. A URL that Twilio will request if an error occurs when requests are made to the URL.This property is ignored if you specify anapplicationSid
.fallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the fallback URL. Defaults to POST. This property is ignored if you specify anapplicationSid
.statusCallback
: Optional. The URL that Twilio will request when the call ends to notify your application. This property is ignored if you specify anapplicationSid
.statusCallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the status callback URL. Defaults to POST. This property is ignored if you specify anapplicationSid
.sendDigits
: Optional. A string of keys to dial after connecting to the number. Valid digits in the string include: any digit (0-9),%23
(the URL-encoded version of #),*
, andw
(to insert a half-second pause). For example, if you are connecting to a company phone number and want to pause for one second, dial extension 1234, and then the pound key, use<sendDigits>ww1234%23</sendDigits>
.ifMachine
: Optional. Specifies whether Twilio should try to determine whether a machine (like voicemail) or a human has answered the call. Possible values are Continue and Hangup. For more information, see http://www.twilio.com/docs/api/rest/making-calls#handling-outcomes-answering-machines.timeout
: Optional. The integer number of seconds that Twilio should allow the phone to ring before assuming there is no answer. Default is 60 seconds, the maximum is 999 seconds. Note, you could set this to a low value, such as 15, to hangup before reaching an answering machine or voicemail.record
: Optional. Specifies whether to record the call. If true, the entire call is recorded, and the recording URL is sent to the status callback URL. Defaults to false.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/making-calls
Getting a list of calls
<twilio.getCallList configKey="MyTwilioConfig"> <to>2B14155551212</to> <from>2B18668675309</from> <status>completed</status> <startTime>2013-09-30</startTime> <parentCallSid>CAe1644a7eed5088b159577c5802d8be38</parentCallSid> </twilio.getCallList>
To get a list of calls, use twilio.getCallList
and specify the following properties.
Properties
to
: Optional. Only get calls made to this phone number, SIP address, or client identifier.from
: Optional. Only get calls made from this phone number or client identifier.status
: Optional. Only get calls currently in this status. May bequeued
,ringing
,in-progress
,canceled
,completed
,failed
,busy
, orno-answer
.startTime
: Optional. Only get calls that started on this date, given as YYYY-MM-DD. Also supports inequalities, such as <=YYYY-MM-DD for calls that started at or before midnight on a date, and >=YYYY-MM-DD for calls that started at or after midnight on a date.parentCallSid
: Optional. Only get calls spawned by the call with this SID.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/call
Getting a specific call
<twilio.getCall configKey="MyTwilioConfig"> <callSid>CAe1644a7eed5088b159577c5802d8be38</callSid> </twilio.getCall>
To get information about a specific call, including start time, end time, and more, use twilio.getCall
and specify the following properties.
Properties
callSid
: The identifier of the call you want to get.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/call
Modifying a live call
<twilio.modifyLiveCall configKey="MyTwilioConfig"> <callSid>CAe1644a7eed5088b159577c5802d8be38</callSid> <url>http://demo.twilio.com/docs/voice.xml</url> <method>POST</method> <status>completed</status> <fallbackUrl>http://demo.twilio.com/docs/voicefallback.xml</fallbackUrl> <fallbackMethod>POST</fallbackMethod> <statusCallback>http://demo.twilio.com/docs/statuscallback.xml</statusCallback> <statusCallbackMethod>GET</statusCallbackMethod> </twilio.modifyLiveCall>
To interrupt an in-progress call and terminate it or process it using a new URL, use twilio.modifyLiveCall
and specify the following properties.
Properties
callSid
: The identifier of the call you want to modify.url
: The fully qualified URL where the call should be redirected.method
: Optional. The HTTP method, GET or POST, to use when connecting to the URL. Defaults to POST.status
: Optional. Eithercanceled
orcompleted
. Specifyingcanceled
will attempt to hang up calls that are queued or ringing but not affect calls already in progress. Specifyingcompleted
will attempt to hang up a call even if it's already in progress.fallbackUrl
: Optional. A URL that Twilio will request if an error occurs when requests are made to the URL.fallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the fallback URL. Defaults to POST.statusCallback
: Optional. The URL that Twilio will request when the call ends to notify your application.statusCallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the status callback URL. Defaults to POST.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/change-call-state
Getting a list of recordings
<twilio.getRecordingList configKey="MyTwilioConfig"> <callSid>CAe1644a7eed5088b159577c5802d8be38</callSid> <dateCreated>2013-09-30</dateCreated> </twilio.getRecordingList>
To get a list of recordings, use twilio.getRecordingList
and specify the following properties.
Properties
callSid
: Optional. Only get recordings made during the call given by this SID.dateCreated
: Optional. Only get recordings created on this date, given as YYYY-MM-DD. Also supports inequalities, such as <=YYYY-MM-DD for recordings generated at or before midnight on a date, and >=YYYY-MM-DD for recordings generated at or after midnight on a date.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/recording#list
Getting a specific recording
<twilio.getRecording configKey="MyTwilioConfig"> <recordingSid>CAe1644a7eed5088b159577c5802d8be38</recordingSid> </twilio.getRecording>
To get information about a specific recording, including date created, duration, and more, use twilio.getRecording
and specify the following properties.
Properties
recordingSid
: The identifier of the recording you want to get.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/recording
Deleting a recording
<twilio.deleteRecording configKey="MyTwilioConfig"> <recordingSid>CAe1644a7eed5088b159577c5802d8be38</recordingSid> </twilio.deleteRecording>
To delete a specific recording, use twilio.deleteRecording
and specify the following properties. Once the recording is deleted, you will no longer be billed for those minutes. If successful, returns HTTP 204 (No Content) with no body.
Properties
recordingSid
: The identifier of the recording you want to delete.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/recording
Getting a list of transcriptions
<twilio.getTranscriptionList configKey="MyTwilioConfig" />
To get a list of transcriptions generated from your account, including information such as status and paging information for each transcription, use twilio.getTranscriptionList
.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/transcription#list
Getting a specific transcription
<twilio.getTranscription configKey="MyTwilioConfig"> <transcriptionSid>TR8c61027b709ffb038236612dc5af8723</transcriptionSid> </twilio.getTranscription>
To get information about a specific transcription, including date created, status, and more, use twilio.getTranscription
and specify the following properties.
Properties
transcriptionSid
: The identifier of the transcription you want to get.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/transcription
Working with conferences
The following operations are available for working with conferences:
Operation | Description |
---|---|
getConferenceList | Returns a list of conferences within an account. The list includes paging information. |
getConference | Returns a specific conference instance. Each conference that starts and ends is considered a unique conference instance. There can be many conference instances that share the same FriendlyName, but only one can be in-progress at any given time. |
getParticipantList | Returns the list of participants in the specific conference. |
getParticipant | Returns a specific conference participant. |
updateParticipant | Mute or unmute a conference participant. |
removeParticipant | Removes a participant from the specified conference. |
Following is more information about these operations.
Getting a list of conferences
<twilio.getConferenceList configKey="MyTwilioConfig"> <status>completed</status> <friendlyName>My Room</friendlyName> <dateCreated>2009-07-06</dateCreated> <dateUpdated>2009-07-06</dateUpdated> </twilio.getConferenceList>
To get a list of conferences within your account, including information such as status and paging information for each conference, use twilio.getConferenceList
and specify the following properties.
Properties
status
: Optional. Only show conferences that currently have this status. Can beinit
,in-progress
, orcompleted
.friendlyName
: Optional. Only show conferences whose friendly name exactly matches this string. Multiple conference instances can have the same friendly name, but only one instance can be in-progress.dateCreated
: Optional. Only get conferences that started on this date, given as YYYY-MM-DD. Also supports inequalities, such as <=YYYY-MM-DD for conferences that started at or before midnight on a date, and >=YYYY-MM-DD for conferences that started at or after midnight on a date.dateUpdated
: Optional. Only get conferences that were last updated on this date, given as YYYY-MM-DD. Also supports inequalities, such as <=YYYY-MM-DD for conferences that were updated at or before midnight on a date, and >=YYYY-MM-DD for conferences that were updated at or after midnight on a date.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/conference#list
Getting a specific conference
<twilio.getConference configKey="MyTwilioConfig"> <conferenceSid>CFbbe46ff1274e283f7e3ac1df0072ab39</conferenceSid> </twilio.getConference>
To get information about a specific conference, including information such as friendly name and participants, use twilio.getConference
and specify the following properties.
Properties
conferenceSid
: The 34-character identifier of the conference whose information you want to retrieve.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/conference
Getting a list of participants
<twilio.getParticipantList configKey="MyTwilioConfig"> <conferenceSid>CFbbe46ff1274e283f7e3ac1df0072ab39</conferenceSid> <muted>false</muted> </twilio.getParticipantList>
To get a list of participants in a conference, use twilio.getParticipantList
and specify the following properties.
Properties
conferenceSid
: The 34-character identifier of the conference whose participants you want to retrieve.muted
: Optional. If true, only show participants who are muted. If false, only show participants who are not muted. If you do not specify this property, both muted and unmuted participants are returned.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/participant#list
Getting a specific participant
<twilio.getParticipant configKey="MyTwilioConfig"> <conferenceSid>CFbbe46ff1274e283f7e3ac1df0072ab39</conferenceSid> <callSid>CA386025c9bf5d6052a1d1ea42b4d16662</callSid> </twilio.getParticipant>
To get information about a specific participant in a conference, use twilio.getParticipant
and specify the following properties.
Properties
conferenceSid
: The 34-character identifier of the conference.callSid
: The 34-character identifier of the call the participant made to connect to this conference.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/participant
Muting or unmuting a participant
<twilio.updateParticipant configKey="MyTwilioConfig"> <conferenceSid>CFbbe46ff1274e283f7e3ac1df0072ab39</conferenceSid> <callSid>CA386025c9bf5d6052a1d1ea42b4d16662</callSid> <muted>false</muted> </twilio.updateParticipant>
To mute or unmute a specific participant in a conference, use twilio.updateParticipant
and specify the following properties.
Properties
conferenceSid
: The 34-character identifier of the conference.callSid
: The 34-character identifier of the call the participant made to connect to this conference.muted
: Set to true to mute the participant or false to unmute the participant.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/participant
Removing a participant
<twilio.removeParticipant configKey="MyTwilioConfig"> <conferenceSid>CFbbe46ff1274e283f7e3ac1df0072ab39</conferenceSid> <callSid>CA386025c9bf5d6052a1d1ea42b4d16662</callSid> </twilio.removeParticipant>
To mute or unmute a specific participant in a conference, use twilio.updateParticipant
and specify the following properties.
Properties
conferenceSid
: The 34-character identifier of the conference.callSid
: The 34-character identifier of the call the participant made to connect to this conference.
Related Twilio documentation
http://www.twilio.com/docs/api/rest/participant
Working with phone numbers
The following operations are available for working with phone numbers:
Operation | Description |
---|---|
addOutgoingPhoneNumber | Adds a new caller ID to your account. |
getOutgoingPhoneNumberList | Returns a list of OutgoingCallerId resource representations, each representing a caller ID number valid for an account. The list includes paging information. |
getOutgoingPhoneNumber | Returns a representation of a specific caller ID number. |
updateOutgoingPhoneNumber | Updates the caller ID, and returns the updated resource if successful. |
removeOutgoingPhoneNumber | Deletes the caller ID from the account. |
getAvailableLocalNumbers | Returns a list of local AvailablePhoneNumber resource representations that match the specified filters, each representing a phone number that is currently available for provisioning within your account. |
getAvailableTollFreeNumbers | Returns a list of AvailableTollFreeNumber resources that match the specified filters, each representing a phone number. |
purchasePhoneNumber | Purchases a new phone number for your account. If a phone number is found for your request, Twilio will add it to your account and bill you for the first month's cost of the phone number. |
getIncomingPhoneNumberList | Returns a list of IncomingPhoneNumber resource representations, each representing a phone number given to your account. The list includes paging information. |
getIncomingPhoneNumber | Returns a IncomingPhoneNumber resource representations, representing a phone number given to your account. |
updateIncomingPhoneNumber | Tries to update the incoming phone number's properties and returns the updated resource representation if successful. |
removeIncomingPhoneNumber | Releases this phone number from your account. Twilio will no longer answer calls to this number, and you will stop being billed the monthly phone number fee. The phone number will eventually be recycled and potentially given to another customer, so use this operation with care. |
Following is more information about these operations.
Adding an outgoing phone number
<twilio.addOutgoingPhoneNumber configKey="MyTwilioConfig"> <phoneNumber>+15105555555</phoneNumber> <friendlyName>(510) 555-5555</friendlyName> <callDelay>30</callDelay> <extension>1234</extension> <statusCallback>http://demo.twilio.com/docs/statuscallback.xml</statusCallback> <statusCallbackMethod>POST</statusCallbackMethod> </twilio.addOutgoingPhoneNumber>
To add a new caller ID to your account, use twilio.addOutgoingPhoneNumber
and specify the following properties. After making this request, Twilio returns a validation code and dials the phone number to perform validation. The code returned must be entered via the phone before the caller ID will be added to your account.
Properties
phoneNumber
: The phone number to verify. Should be formatted with a '+' and country code, e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers, e.g., (415) 555-1212, 415-555-1212.friendlyName
: Optional. A human readable description for the new caller ID with maximum length 64 characters. Defaults to a nicely formatted version of the number.callDelay
: Optional. The number of seconds, between 0 and 60, to delay before initiating the verification call. Defaults to 0.extension
: Optional. Digits to dial after connecting the verification call.statusCallback
: Optional. The URL that Twilio will request when the verification call ends to notify your application whether the verification was successful.statusCallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the status callback URL. Defaults to POST.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/outgoing-caller-ids#list-post
Getting a list of outgoing phone numbers
<twilio.getOutgoingPhoneNumberList configKey="MyTwilioConfig"> <phoneNumber>+15105555555</phoneNumber> <friendlyName>(510) 555-5555</friendlyName> </twilio.getOutgoingPhoneNumberList>
To get a list of caller IDs for this account, use twilio.getOutgoingPhoneNumberList
and specify the following properties. The list returns information about each caller ID including the SID, friendly name, and more. The list includes paging information.
Properties
phoneNumber
: Optional. Only shows the caller ID resource with this phone number. Should be formatted with a '+' and country code, e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers, e.g., (415) 555-1212, 415-555-1212.friendlyName
: Optional. Only shows the caller ID resource with this friendly name.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/outgoing-caller-ids#list-get
Getting a specific outgoing phone number
<twilio.getOutgoingPhoneNumber configKey="MyTwilioConfig"> <outgoingCallerId>PNe905d7e6b410746a0fb08c57e5a186f3</outgoingCallerId> </twilio.getOutgoingPhoneNumber>
To get information about a specific caller ID for this account, use twilio.getOutgoingPhoneNumber
and specify the following properties.
Properties
outgoingCallerId
: The 34-character string that identifies this caller ID record.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/outgoing-caller-ids#instance-get
Updating an outgoing phone number
<twilio.updateOutgoingPhoneNumber configKey="MyTwilioConfig"> <outgoingCallerId>PNe905d7e6b410746a0fb08c57e5a186f3</outgoingCallerId> <friendlyName>(510) 555-5555</friendlyName> </twilio.updateOutgoingPhoneNumber>
To update the friendly name for a caller ID, use twilio.updateOutgoingPhoneNumber
and specify the following properties.
Properties
outgoingCallerId
: The 34-character string that identifies this caller ID record.friendlyName
: The new friendly name for this caller ID.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/outgoing-caller-ids#instance-post
Removing an outgoing phone number
<twilio.removeOutgoingPhoneNumber configKey="MyTwilioConfig"> <outgoingCallerId>PNe905d7e6b410746a0fb08c57e5a186f3</outgoingCallerId> </twilio.removeOutgoingPhoneNumber>
To remove a caller ID from your account, use twilio.removeOutgoingPhoneNumber
and specify the following properties.
Properties
outgoingCallerId
: The 34-character string that identifies the caller ID record you want to remove from the account.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/outgoing-caller-ids#instance-delete
Getting a list of available local phone numbers
<twilio.getAvailableLocalNumbers configKey="MyTwilioConfig"> <country>US</country> <areaCode>(415)</areaCode> <contains>ACME</contains> <inRegion>CA</inRegion> <inPostalCode>94133</inPostalCode> <nearLatLong>37.840699%2C-122.461853</nearLatLong> <nearNumber>(415) 555-1234</nearNumber> <inLata>722</inLata> <inRateCenter>SNFC CNTR</inRateCenter> <distance>50</distance> </twilio.getAvailableLocalNumbers>
To get a list of available local phone numbers you can purchase, use twilio.getAvailableLocalNumbers
and specify the following properties.
Properties
country
: The country code (such as US for United States, CA for Canada, and GB for United Kingdom) in which you want to find available toll-free numbers.areaCode
: Optional. Only shows numbers in this area code.contains
: Optional. Only shows numbers that match the specified pattern. Valid characters are * and 0-9a-zA-Z. The * character will match any single digit. For an example, see https://www.twilio.com/docs/api/rest/available-phone-numbers#local-get-basic-example-2.inRegion
: Optional. Only shows numbers in this region (state or province).inPostalCode
: Optional. Only shows numbers in this postal code.nearLatLong
: Optional. Only shows numbers within 25 miles of this latitude/longitude coordinate. To change the search distance from the given coordinate, also specify thedistance
property.nearNumber
: Optional. Only shows numbers within 25 miles of this phone number. To change the search distance from the given number, also specify thedistance
property.inLata
: Optional. Only shows numbers in this Local Access and Transport Area (LATA).inRateCenter
: Optional. Only shows numbers in this rate center.- distance: Optional. Specifies the distance from the coordinate (
nearLatLong
) or number (nearNumber
) to search, up to 500 miles. Defaults to 25.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/available-phone-numbers#local
Getting a list of available toll-free phone numbers
<twilio.getAvailableTollFreeNumbers configKey="MyTwilioConfig"> <country>US</country> <areaCode>(866)</areaCode> <contains>ACME</contains> </twilio.getAvailableTollFreeNumbers>
To get a list of available toll-free phone numbers you can purchase, use twilio.getAvailableTollFreeNumbers
and specify the following properties.
Properties
country
: The country code (such as US for United States, CA for Canada, and GB for United Kingdom) in which you want to find available toll-free numbers. For more information on country codes supported by Twilio, see https://www.twilio.com/docs/api/rest/available-phone-numbers#countriesareaCode
: Optional. Only shows numbers in this area code.contains
: Optional. Only shows numbers that match the specified pattern. Valid characters are * and 0-9a-zA-Z. The * character will match any single digit. For an example, see https://www.twilio.com/docs/api/rest/available-phone-numbers#toll-free-get-example-2.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/available-phone-numbers#toll-free
Purchasing an incoming phone number
<twilio.purchasePhoneNumber configKey="MyTwilioConfig"> <phoneNumber>15105555555</phoneNumber> <friendlyName>(510) 555-5555</friendlyName> <voiceUrl>http://demo.twilio.com/docs/voice.xml</voiceUrl> <voiceMethod>POST</voiceMethod> <voiceFallbackUrl>http://demo.twilio.com/docs/voicefallback.xml</voiceFallbackUrl> <voiceFallbackMethod>POST</voiceFallbackMethod> <statusCallback>http://demo.twilio.com/docs/statuscallback.xml</statusCallback> <statusCallbackMethod>GET</statusCallbackMethod> <voiceCallerIdLookup>false</voiceCallerIdLookup> <smsApplicationSid>AP2a0747eba6abf96b7e3c3ff0b4530f6e</smsApplicationSid> <apiVersion>2010-04-01</apiVersion> </twilio.purchasePhoneNumber>
To purchase an incoming phone number, use twilio.purchasePhoneNumber
and specify the following properties.
Properties
phoneNumber
orareaCode
: Specify the exact phone number you want to purchase, or specify an area code to search for and purchase a phone number in that area code. Only specify one of these properties. If specifying the phone number, it should be formatted starting with a '+' followed by the country code and the number in E.164 format, e.g., '+15105555555'. If specifying the area code, any three-digit, US or Canada area code is valid. Twilio will provision a random phone number within this area code for you.friendlyName
: The friendly name for this phone number.voiceApplicationSid
or individual voice properties: You can specify thevoiceApplicationSid
, a 34-character string that uniquely identifies the application that defines the properties to use for handling calls to this number, or you can specify the individual voice properties, which are ignored if you specifyvoiceApplicationSid
:voiceUrl
: The URL that Twilio should request when somebody dials this phone number.voiceMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the voice URL. Defaults to POST.voiceFallbackUrl
: Optional. A URL that Twilio will request if an error occurs when requests are made to the voice URL.voiceFallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the voice fallback URL. Defaults to POST.statusCallback
: Optional. The URL that Twilio will request to pass status parameters (such as call ended) to your application.statusCallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the status callback URL. Defaults to POST.
voiceCallerIdLookup
: Optional. If true, performs a lookup of the caller's name from the CNAM database and posts it to your app. Defaults to false.smsApplicationSid
or individual SMS properties: You can specify thesmsApplicationSid
, a 34-character string that uniquely identifies the application that defines the properties to use for handling SMS messages to this number, of you can specify the individual SMS properties, which are ignored if you specifysmsApplicationSid
:smsUrl
: The URL that Twilio should request when somebody sends an SMS to this phone number.smsMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the SMS URL. Defaults to POST.smsFallbackUrl
: Optional. The URL that Twilio will request if an error occurs when requests are made to the SMS URL.smsFallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the SMS fallback URL. Defaults to POST.
apiVersion
: Optional. Specifies the API version, either 2010-04-01 or 2008-08-01, to use when requests are made to this phone number. Defaults to your account's default API version.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/incoming-phone-numbers#list-post
Getting a list of incoming phone numbers
<twilio.getIncomingPhoneNumberList configKey="MyTwilioConfig"> <phoneNumber>555****</phoneNumber> <friendlyName>(510) 555-5555</friendlyName> </twilio.getIncomingPhoneNumberList>
To get a list of incoming phone numbers for this account, use twilio.getIncomingPhoneNumberList
and specify the following properties. The list returns information about each phone number including the SID, friendly name, and more. The list includes paging information.
Properties
phoneNumber
: Optional. Only shows the incoming phone number resources that match this pattern. You can specify partial numbers and use*
as a wildcard for any digit.friendlyName
: Optional. Only shows the incoming phone number resources whose friendly names exactly match this name.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/incoming-phone-numbers#list
Getting a specific incoming phone number
<twilio.getIncomingPhoneNumber configKey="MyTwilioConfig"> <incomingCallerId>PNe905d7e6b410746a0fb08c57e5a186f3</incomingCallerId> </twilio.getIncomingPhoneNumber>
To get information about a specific caller ID for this account, use twilio.getOutgoingPhoneNumber
and specify the following properties.
Properties
incomingCallerId
: The 34-character string that identifies this incoming phone number record.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/incoming-phone-numbers#instance-get
Updating an incoming phone number
<twilio.updateIncomingPhoneNumber configKey="MyTwilioConfig"> <incomingCallerId>PNe905d7e6b410746a0fb08c57e5a186f3</incomingCallerId> <accountSid>AC755325d45d80675a4727a7a54e1b4ce4</accountSid> </twilio.updateIncomingPhoneNumber>
To update the properties of an incoming phone number, use twilio.updateIncomingPhoneNumber
, specify the phone number's SID, and then specify one or more of the properties you set when purchasing the phone number. In addition, you can set the accountSid
property to transfer this number to a different account. For more information on transferring numbers, see https://www.twilio.com/docs/api/rest/subaccounts#exchanging-numbers.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/incoming-phone-numbers#instance-post
Removing an incoming phone number
<twilio.removeIncomingPhoneNumber configKey="MyTwilioConfig"> <incomingCallerId>PNe905d7e6b410746a0fb08c57e5a186f3</incomingCallerId> </twilio.removeIncomingPhoneNumber>
To remove an incoming phone number from your account, use twilio.removeIncomingPhoneNumber
and specify the following properties.
Properties
incomingCallerId
: The 34-character string that identifies the incoming phone number record you want to remove from the account.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/incoming-phone-numbers#instance-delete
Working with queues
The following operations are available for working with queues:
Operation | Description |
---|---|
createQueue | Creates a new queue. |
getQueueList | Retrieves a list of existing queues. |
getQueue | Retrieves information about a specific queue. |
updateQueue | Change the friendly name or max size of a queue. |
getMemberList | Retrieves a list of the members in a queue. |
getMember | Retrieves information about a specific member. |
dequeueMember | Removes a member from the specified queue and starts executing the call. |
Following is more information about these operations.
Creating a queue
<twilio.createQueue configKey="MyTwilioConfig"> <friendlyName>persistent_queue1</friendlyName> <maxSize>30</maxSize> </twilio.createQueue>
To create a new queue, use twilio.createQueue
and specify the following properties.
Properties
friendlyName
: A human readable description for the new queue.maxSize
: Optional. The maximum number of members (calls) that can be in this queue simultaneously. Maximum value is 1000. Defaults to 100.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/queue#list-post
Getting a list of existing queues
<twilio.getQueueList configKey="MyTwilioConfig" />
To get a list of existing queues, use twilio.getQueueList
. The list returns information about each queue, including SID, current size, average wait time, and more. The list includes paging information.
Properties
friendlyName
: A human readable description for the new queue.maxSize
: Optional. The maximum number of members (calls) that can be in this queue simultaneously. Maximum value is 1000. Defaults to 100.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/queue#list-get
Getting a specific queue
<twilio.getQueue configKey="MyTwilioConfig"> <queueSid>QU5ef8732a3c49700934481addd5ce1659</queueSid> </twilio.getQueue>
To get information about a specific queue, use twilio.getQueue
and specify the following properties.
Properties
queueSid
: The 34-character string that uniquely identifies this queue.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/queue#instance-get
Updating a queue
<twilio.updateQueue configKey="MyTwilioConfig"> <queueSid>QU5ef8732a3c49700934481addd5ce1659</queueSid> <friendlyName>persistent_queue1</friendlyName> <maxSize>30</maxSize> </twilio.updateQueue>
To update the friendly name or max size of an existing queue, use twilio.updateQueue
and specify the following properties.
Properties
queueSid
: The 34-character string that uniquely identifies this queue.friendlyName
: Optional. A human readable description for the queue.maxSize
: Optional. The maximum number of members (calls) that can be in this queue simultaneously. Maximum value is 1000. Defaults to 100.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/queue#instance-post
Getting a list of members in a queue
<twilio.getMemberList configKey="MyTwilioConfig"> <queueSid>QU5ef8732a3c49700934481addd5ce1659</queueSid> </twilio.getMemberList>
To get a list of members in a queue, use twilio.getMemberList
and specify the following properties. The list returns information about each member, including SID, average wait time, position in the queue, and more.
Properties
queueSid
: The 34-character string that uniquely identifies the queue whose members you want to retrieve.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/queue#instance-subresources
Getting a specific member
<twilio.getMember configKey="MyTwilioConfig"> <queueSid>QU5ef8732a3c49700934481addd5ce1659</queueSid> <callSid>CA386025c9bf5d6052a1d1ea42b4d16662</callSid> </twilio.getMember>
To get information about a specific member in a queue, including SID, wait time, position in the queue, and more, use twilio.getMember
and specify the following properties.
Properties
queueSid
: The 34-character string that uniquely identifies the queue.callSid
: the 34-character string that uniquely identifies the member whose information you want to retrieve.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/member#instance-get
Dequeing a specific member
<twilio.dequeueMember configKey="MyTwilioConfig"> <queueSid>QU5ef8732a3c49700934481addd5ce1659</queueSid> <callSid>CA386025c9bf5d6052a1d1ea42b4d16662</callSid> <url>http://demo.twilio.com/docs/voice.xml</url> </twilio.dequeueMember>
To remove a member from the queue and start processing the call, use twilio.dequeueMember
and specify the following properties.
Properties
queueSid
: The 34-character string that uniquely identifies the queue.callSid
: the 34-character string that uniquely identifies the member you want to remove from the queue and start processing.url
: The URL that Twilio should use to process this call.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/member#instance-post
Working with SMS messages
The following operations are available for working with SMS messages:
Operation | Description |
---|---|
sendSms | Sends a new outgoing SMS message. |
getSmsList | Retrieves a list of SMS messages associated with your account. |
getSms | Retrieves information about a specific SMS message. |
getShortCodeList | Retrieves a list of short codes associated with your account. |
getShortCode | Retrieves information about a specific short code. |
updateShortCodeProperties | Updates the properties of a short code. |
Following is more information about these operations.
Sending an SMS message
<twilio.sendSms configKey="MyTwilioConfig"> <body>Jenny%20please%3F%21%20I%20love%20you%20<3</body> <to>%2B14159352345</to> <from>%2B14158141829</from> <statusCallbackUrl>http://demo.twilio.com/docs/statuscallback.xml</statusCallBackUrl> <applicationSid>AP2a0747eba6abf96b7e3c3ff0b4530f6e</applicationSid> </twilio.sendSms>
To send an SMS message, use twilio.sendSms
and specify the following properties.
Properties
body
: The text of the message you want to send, up to 160 characters.to
: The destination phone number. Format with a '+' and country code, e.g., +16175551212 (E.164 format). For 'To' numbers without a '+', Twilio will use the same country code as the 'From' number. Twilio will also attempt to handle locally formatted numbers for that country code (e.g., (415) 555-1212 for US, 07400123456 for GB). If you are sending to a different country than the 'From' number, you must include a '+' and the country code to ensure proper delivery.from
: A Twilio phone number enabled for SMS. Only phone numbers or short codes purchased from Twilio work here; for example, you cannot spoof SMS messages from your own cell phone number.statusCallbackUrl
: Optional. A URL that Twilio will POST to when your message is processed. Twilio will POST the SMS SID as well as statussent
orfailed
.applicationSid
: Optional. Twilio will POST the SMS SID as well as statussent
orfailed
to the URL in the SMS status callback property of this application. If thestatusCallBackUrl
parameter above is also passed, the application's SMS status callback parameter will take precedence.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/sending-sms
Getting a list of SMS messages
<twilio.getSmsList configKey="MyTwilioConfig"> <to>%2B14159352345</to> <from>%2B14158141829</from> <dateSent>2009-07-06</dateSent> </twilio.getSmsList>
To get a list of SMS messages associated with this account, including the SID, status, and more for each message, use twilio.getSmsList
and specify the following properties. The list includes paging information.
Properties
to
: Optional. Only shows messages to the specified phone number.from
: Optional. Only shows messages from the specified phone number.dateSent
: Optional. Only shows messages sent on this date (in GMT format), given as YYYY-MM-DD. You can also specify inequality, such as<=YYYY-MM-DD
for SMS messages that were sent on or before midnight on a date, and>=YYYY-MM-DD
for SMS messages sent on or after midnight on a date.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/sms#list-get
Getting a specific SMS message
<twilio.getSms configKey="MyTwilioConfig"> <messageSid>%SM800f449d0399ed014aae2bcc0cc2f2ec</messageSid> </twilio.getSms>
To get information about a specific SMS message, including the SID, status, and more, use twilio.getSms
and specify the following properties.
Properties
messageSid
: The 34-character string that uniquely identifies this SMS message.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/sms#instance-get
Getting a list of short codes
<twilio.getShortCodeList configKey="MyTwilioConfig"> <shortCode>67898</shortCode> <friendlyName>67898</friendlyName> </twilio.getShortCodeList>
To get a list of short codes associated with this account, use twilio.getShortCodeList
and specify the following properties. The list includes paging information.
Properties
shortCode
: Optional. Only shows the short code resources that match this pattern. You can specify partial numbers and use*
as a wildcard for any digit.friendlyName
: Optional. Only shows short codes whose friendly names exactly match this name.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/short-codes#list-get
Getting a specific short code
<twilio.getShortCode configKey="MyTwilioConfig"> <shortCodeSid>SC6b20cb705c1e8f00210049b20b70fce2</shortCode> </twilio.getShortCode>
To get information about a specific short code, including its account SID, SMS URL, and more, use twilio.getShortCode
and specify the following properties.
Properties
shortCodeSid
: The 34-character string that uniquely identifies this short code.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/short-codes#instance-get
Updating a short code
<twilio.updateShortCodeProperties configKey="MyTwilioConfig"> <shortCodeSid>SC6b20cb705c1e8f00210049b20b70fce2</shortCode> <friendlyName>67898</friendlyName> <apiVersion>2010-04-01</apiVersion> <smsUrl>http://demo.twilio.com/docs/sms.xml</smsUrl> <smsMethod>POST</smsMethod> <smsFallbackUrl>http://demo.twilio.com/docs/smsfallback.xml</smsFallbackUrl> <smsFallbackMethod>POST</smsFallbackMethod> </twilio.updateShortCodeProperties>
To update the properties of a short code, use twilio.updateShortCode
and specify the following properties.
Properties
shortCodeSid
: The 34-character string that uniquely identifies this short code.friendlyName
: Optional. The human-readable description of this short code.smsUrl
: Optional. The URL that Twilio should request when somebody sends an SMS to this phone number.smsMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the SMS URL. Defaults to POST.smsFallbackUrl
: Optional. The URL that Twilio will request if an error occurs when requests are made to the SMS URL.smsFallbackMethod
: Optional. The HTTP method, either GET or POST, that should be used to request the SMS fallback URL. Defaults to POST.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/short-codes#instance-post
Working with usage records and triggers
The following operations are available for working with usage records and triggers:
Operation | Description |
---|---|
getUsageRecordList | Retrieves a list of usage records associated with the account. |
addUsageTrigger | Creates a new usage trigger that will notify your application of usage thresholds. |
getUsageTriggerList | Retrieves a list of existing usage triggers. |
getUsageTrigger | Retrieves information about a specific usage trigger. |
updateUsageTrigger | Updates the properties of a usage trigger. |
removeUsageTrigger | Removes a usage trigger from your account. |
Following is more information about these operations.
Getting a list of usage records
<twilio.getUsageRecordList configKey="MyTwilioConfig"> <usageCategory>calls</usageCategory> <startDate>2013-04-01</startDate> <endDate>2013-04-30</endDate> </twilio.getUsageRecordList>
To get a list of usage records, use twilio.getUsageRecordList
and specify the following properties. By default, the list includes one usage record for each category, representing all usage accrued all-time for the account. The list includes paging information.
Properties
usageCategory
: Optional. Only shows usage records for the specified usage category.startDate
: Optional. Only include usage that has occurred on or after this date. Format is YYYY-MM-DD. All dates are in GMT. You can also specify offsets from today. For example,-30days
will set the start date to 30 days before today.endDate
:Only include usage that has occurred on or before this date. Format is YYYY-MM-DD. All dates are in GMT. You can also specify offsets from today. For example,+30days
will set the start date to 30 days after today.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/usage-records#list-get
Creating a usage trigger
<twilio.addUsageTrigger configKey="MyTwilioConfig"> <usageCategory>calls</usageCategory> <triggerValue>1000</triggerValue> <callbackUrl>http://www.example.com/</callbackUrl> <friendlyName>Trigger for sms at usage of 1000</friendlyName> <triggerBy>usage</triggerBy> <recurring>daily</recurring> <callbackMethod>POST</callbackMethod> </twilio.addUsageTrigger>
To create a trigger that will notify your application when a usage threshold has been passed, use twilio.addUsageTrigger
and specify the following properties.
Properties
usageCategory
: The usage category you want this trigger to monitor.triggerValue
: The value for the usage category at which this trigger will fire. You can use an offset like+30
, which tells Twilio to create the usage trigger with a trigger value 30 units higher than the current usage.callbackUrl
: The URL to call when this trigger fires.friendlyName
: Optional. A human-readable description of this trigger, up to 64 characters.triggerBy
: Optional. The field in the usage record that will fire this trigger. Can becount
,usage
, orprice
. The default isusage
.recurring
: Optional. To make this a recurring trigger that counts based on a specific interval, specify the interval in this property. Can bedaily
,monthly
, oryearly
.callbackMethod
: Optional. The HTTP method, eitherGET
orPOST
, to use when calling the callback URL. Defaults toPOST
.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/usage-triggers#list-post
Getting a list of usage triggers
<twilio.getUsageTriggerList configKey="MyTwilioConfig"> <recurring>daily</recurring> <usageCategory>calls</usageCategory> <triggerBy>usage</triggerBy> </twilio.getUsageTriggerList>
To get a list of usage triggers, use twilio.getUsageTriggerList
and specify the following properties. By default, all usage triggers are returned. The list includes paging information.
Properties
recurring
: Optional. Only shows usage triggers that count based on this interval. Can bedaily
,monthly
, oryearly
. To get non-recurring triggers, set this property toalltime
or leave it blank.usageCategory
: Optional. Only shows triggers that monitor the specified usage category.triggerBy
: Optional. Only shows triggers that are fired by the specified field in the usage record. Can becount
,usage
, orprice
. The default isusage
.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/usage-triggers#list-get
Getting a specific usage trigger
<twilio.getUsageTrigger configKey="MyTwilioConfig"> <usageTriggerSid>UT33c6aeeba34e48f38d6899ea5b765ad4</usageTriggerSid> </twilio.getUsageTrigger>
To get information about a specific usage trigger, including the trigger's SID, usage category, current value, and more, use twilio.getUsageTrigger
and specify the following properties.
Properties
usageTriggerSid
: The 34-character string that uniquely identifies this usage trigger.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/usage-triggers#instance-get
Updating a usage trigger
<twilio.updateUsageTrigger configKey="MyTwilioConfig"> <usageTriggerSid>UT33c6aeeba34e48f38d6899ea5b765ad4</usageTriggerSid> <friendlyName>Trigger for sms at usage of 1000</friendlyName > <callbackUrl>http://www.example.com/</callbackUrl> <callbackMethod>POST</callbackMethod> </twilio.updateUsageTrigger>
To update properties for a specific usage trigger, use twilio.updateUsageTrigger
and specify the following properties.
Properties
usageTriggerSid
: The 34-character string that uniquely identifies this usage trigger.friendlyName
: Optional. A human-readable description of this trigger, up to 64 characters.callbackUrl
: Optional. The URL to call when this trigger fires.callbackMethod
: Optional. The HTTP method, eitherGET
orPOST
, to use when calling the callback URL. Defaults toPOST
.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/usage-triggers#instance-post
Removing a usage trigger
<twilio.removeUsageTrigger configKey="MyTwilioConfig"> <usageTriggerSid>UT33c6aeeba34e48f38d6899ea5b765ad4</usageTriggerSid> </twilio.removeUsageTrigger>
To remove a usage trigger from your account, use twilio.removeUsageTrigger
and specify the following properties.
Properties
usageTriggerSid
: The 34-character string that uniquely identifies this usage trigger.
Related Twilio documentation
https://www.twilio.com/docs/api/rest/usage-triggers#instance-delete