twimlbin.com was created in 2011 by developers in the Twilio community to rapidly prototype solutions like call forwarding or conference calls. twimlbin.com handled the hosting of TwiML, and allowed Voice and SMS apps to be created without the need to spin up a server. This was such a useful tool that twimlbin.com quickly became popular, powering almost 100 thousand Twilio phone numbers.
With the addition of TwiML Bins in the Console, we’ve made twimlbin.com functionality a native experience. Additionally, native TwiML Bins are hosted on Twilio’s global cloud infrastructure and backed by our world-class security and cloud ops teams for dependable performance.
This guide covers the necessary steps in order to move your twimlbin.com functionality to the new TwiML Bins.
Log in to the Twilio Console using your Twilio account credentials, and open the TwiML Bin section. If you haven’t worked with TwiML Bins in the Console before, you will find a link to the TwiML Bin section on the Explore Products page under Developer Tools.
You will see the option to create a new TwiML Bin as well as a list of your existing TwiML Bins, if any.
When you create a new TwiML Bin, you’ll be presented with the ability to give it a friendly name and, of course, some TwiML that will define the behavior of your Voice or SMS application.
Once you’ve created a new TwiML Bin, you can navigate to the Phone Numbers section and configure Twilio to run your TwiML when a phone call or SMS message comes in.
In the Voice or Messaging section of the active number page, you will see descriptions of the events that can be triggered during a call:
- A call/message comes in for this phone number.
- The primary handler for (1) fails.
- The status of the call has changed.
In addition to providing a webhook, a developer can now choose to handle incoming call and messaging events with a TwiML Bin. Select TwiML from the A Call/Message Comes In drop-down, and you will have the option to select a TwiML Bin to attach to the specified phone number. When the selected type of event comes in to this Twilio number, Twilio will execute the TwiML you’ve provided without the need for your own web server.
You likely are reading this guide because you have some TwiML being hosted by twimlbin.com that must be migrated to the Twilio Console. Follow the steps below to safely migrate your TwiML from twimlbin.com to TwiML Bins.
Twimlbin.com responds to any incoming request with your hosted TwiML, however, Console TwiML Bins must be called by Twilio itself (such as webhooks on Calls and SMS) or with an accompanying, valid
X-Twilio-Signature header. Otherwise, they will return 401 instead of valid TwiML and could potentially break your application.
First, determine all of your twimlbin.com content that must be migrated. This will be easiest if you already have records of all twimlbin.com URLs in use by your application. If there are no records to work with, you can:
- Search your codebase for all references to twimlbin.com, this should generate a list of all URLs that will need to be migrated.
- Refer to the configuration for all of your Twilio phone numbers, and the Webhook URL provided for each number that points to a twimlbin.com address.
Your twimlbin.com TwiML will be accessible by visiting the specific URL for that TwiML, such as: http://twimlbin.com/external/f613ffcaaa685d9745886adc9504e29b.
To view the TwiML itself, append
/raw to the URL. For example: http://twimlbin.com/external/f613ffcaaa685d9745886adc9504e29b/raw
For each twimlbin.com URL, perform the following steps:
- Visit the URL with
/rawappended to it. This will give you the raw TwiML response that your application expects from that URL.
- Create a new TwiML Bin as described in the Getting Started section.
- Give the TwiML Bin an appropriate Friendly Name.
- Paste the raw content from step 1 into the TwiML field of the new TwiML Bin.
- Save the new TwiML Bin, and copy its unique URL.
- Replace all instances of the original twimlbin.com URL from step 1 in your application code with the new TwiML Bin URL from step 5, if applicable. If the original URL was a Twilio webhook, be sure to assign the new TwiML Bin as the primary handler for incoming calls or messages for your phone number, depending on which event type it was already handling.