TwiML Bins let users create and post TwiML response scripts that tell us how to handle incoming communications. TwiML Bins are free to use, and easy to setup, making them our first recommendation for simple automated replies, or phone number forwarding. This guide explains how to setup and use TwiML Bins, and covers the following topics:
TwiML Overview
When you receive an incoming call, message, or fax to your Twilio phone number, we need instructions that tell us how to process the communication. We accept these instructions in the form of TwiML - our XML-based markup language.
TwiML Bins allow you to post your own TwiML response scripts through Console. And since it's XML-based, there's no previous coding knowledge needed. You can find our guides for composing TwiML responses here:
Create a TwiML Bin
- Access the TwiML Bins page in Console.
- Projects with no existing TwiML Bins will see a notice advising of this. Click Create new TwiML Bin to continue.
- Projects with other live TwiML Bins can click the blue plus sign + button.
- Projects with no existing TwiML Bins will see a notice advising of this. Click Create new TwiML Bin to continue.
- Enter the desired name for your TwiML Bin. This is only for your reference.
- Enter the desired TwiML code in XML format.
- When finished, you should see a
Valid TwiML
message below your code. Click Save to continue.
Note: If you see anInvalid
message, please review the documentation for TwiML commands.
Configure your phone number to use a TwiML Bin
You can enable your TwiML Bin for incoming communications from the Active Numbers page in Console. Click the desired phone number to modify, and then follow the below steps for each communication type.
Programmable Messaging: Scroll to the "Messaging" section, and then select the following options. Click Save when finished.
- Configure with: Webhooks, TwiML Bins, Functions, Studio, or Proxy
- A Message Comes in: TwiML Bin
- Empty field: Select the desired saved TwiML Bin from the drop-down menu.
Programmable Voice: Scroll to the "Voice" or "Voice & Fax" section, and then select thefollowing options. Click Save when finished.
- Accept incoming: Voice Calls
- Configure with: Webhooks, TwiML Bins, Functions, Studio, or Proxy
- A Call Comes in: TwiML Bin
- Empty field: Select the desired saved TwiML Bin from the drop-down menu.