Getting started with TwiML Bins

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

  1. 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.
      TwiMLBins_GSG_01_400px.png 
    • Projects with other live TwiML Bins can click the red plus sign + button.
      TwiMLBins_GSG_02_400px.png 
  2. Enter the desired name for your TwiML Bin. This is only for your reference.
    TwiMLBins_GSG_03_400px.png 
  3. Enter the desired TwiML code in XML format.
    TwiMLBins_GSG_04_400px.png 
  4. When finished, you should see a Valid TwiML message below your code. Click Save to continue.
    Note: If you see an Invalid message, please review the documentation for TwiML commands.
    TwiMLBins_GSG_05_400px.png 

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.

Programmable Fax: Scroll to the "Voice & Fax" section, and then select thefollowing options. Click Save when finished.

  • Accept incoming: Faxes
  • Configure with: Webhooks, TwiML Bins, Functions, Studio, or Proxy
  • A Fax Comes in: TwiML Bin
  • Empty field: Select the desired saved TwiML Bin from the drop-down menu.
Have more questions? Submit a request
Powered by Zendesk