Introducing Twilio Applications: An Easier Way to Manage Phone Numbers

June 09, 2011
Written by
John Sheehan
Contributor
Opinions expressed by Twilio contributors are their own

Twilio Bug Logo

Today we’re excited to announce a new feature for Twilio developers: the ability to create and assign a Twilio Application to a phone number instead of a URL. When you log into Twilio.com you’ll see a new tab in your account dashboard called “Apps” where you can create and manage your applications. Applications make it easy to change voice and SMS URLs and other settings across many phone numbers in a single place. In addition to an updated dashboard, we’ve added complete REST API support for managing your apps from your code.

Configure Multiple Numbers with a Single Application

If you’re like many Twilio customers, you might have hundreds or thousands of phone numbers pointing to the exact same set of URLs. When updating the settings for a large set of numbers you would need to update each one individually in the Twilio.com account dashboard, or write a script to update them one at a time via the REST API.

With Twilio Applications, you simply change the VoiceUrl, SmsUrl or other settings in your application and it will be immediately updated for all your numbers assigned to that application.

Twilio Apps In Action

Using Applications via the REST API

Applications have complete REST API support so you can view, create and update application settings from your code. Phone numbers can be updated to use an application via the API as well. Here are a few examples of managing your applications via the REST API.

Creating a New Application

You can create a new application for your account by making a POST request to the new Applications List Resource with the URL options specified. Specify the friendly name and any additional voice and SMS settings your application will use.

POST /2010-04-01/Accounts/AC12345/Applications
FriendlyName=Callertron&VoiceUrl=http://example.com/voice
&SmsUrl=http://example.com/sms&StatusCallback=http://example.com/callback

Twilio will respond to the request with a representation of the newly-created Application Instance Resource which includes the ApplicationSid. The documentation has been updated with complete information for managing applications.

Updating a Phone Number to Use an Application

Once you have created an application, you can update a phone number to point to it instead of a URL. Every application you create has a unique ApplicationSid. To assign it to a phone number, specify the VoiceApplicationSid or SmsApplicationSid when making a POST request to the IncomingPhoneNumber Instance Resource.

POST /2010-04-01/Accounts/AC1f3cff/IncomingPhoneNumbers/PN45678
VoiceApplicationSid=AP1a2b3&SmsApplicationSid=AP4d5ef

If you specify both an ApplicationSid and a URL in your request for either voice or SMS, the application settings will take precedence.

Make an Outbound Call Using an Application

You can also use an application to control a call when making an outbound call via the REST API. Instead of specifying a Url parameter, you can optionally specify an ApplicationSid parameter. When the call is answered, the VoiceUrl setting of your application will be used to control the call.

POST /2010-04-01/Accounts/AC1f3cff/Calls
To=+15558675309&From=+15555551212&ApplicationSid=AP9g8f4


Twilio Applications have been enabled for all existing and new customers. If you have any questions about how to use set up and configure them for your projects, drop us a note at help@twilio.com or tweet to @Twilio and we’ll be happy to assist you.