Skip to main content

XML Bins

What Are XML Bins?

XML bins, sometimes referred to as LaML bins, create a URL endpoint that responds with a set of instructions that can be executed to handle calls, SMS, or fax.

XML Bins are great tools that rely on simple logic. Commands such as <Gather> can handle call or message flows within the action parameter, but complex logic such as "Press 1 for sales, 2 for support, etc." will require using one of our SDKs and hosting the code on a server instead of using bins. Gathering Keypad Input is a good example of <Gather>, using simple logic LaML Bins can handle, and what type of logic that would require hosting your own code.

What is the difference between Webhooks and XML Bins?

Webhooks pass requests to a web application that is hosted from a server or ssh tunnel. XML bins are effectively server-less. When an XML bin is given a request it responds directly with XML/LaML commands. You can read more about SignalWire webhooks in our Webhooks Overview.

What do I need?

All you will need is a SignalWire account, which you can sign up for here. Signing in with your SignalWire username and password will bring you to the dashboard.

Additional Information

While bins can be created and updated programmatically (more info HERE), this guide will walk you through XML bins via the SignalWire dashboard. For more on the dashboard, see our guide to Navigating Your SignalWire Space.

From The Dashboard:

Once you are logged in, on the left-hand side of your dashboard should be several tabs. We are interested in the "LaML" tab.

A screenshot of the menu pane of a SignalWire Space showing the LaML tab.

LaML Logs

Navigating to this tab will open a panel that contains logs for you for items such as Voice, Messaging , ect. Here you will also notice the Bins tab which is what we are looking for.

A screenshot of the LaML tab, with the 'Bins' tab circled in red.

The Bins Tab

Once we have navigated to the Bins tab, we will see a list the bins we have created, as well as their request URL, the amount of requests received, and the last time a request was made to a bin. In the top right we will see a +New button which will allow us to create a new bin.

A screenshot of the 'Bins' tab with the blue 'New' button circled in red.

New Bin

Here we can name our bins, and provide a set of instructions to be executed when the bin is requested. In this case, our Response to an incoming call would use text-to-speech to say "Hello, Welcome to SignalWire!".

A screenshot of the new bin. There are input fields for the Bin Name as well as the content of the LaML code.

Saving a bin

Once we have inserted our LaML instructions we can Save the bin, and we will be taken back to the previous page.

Now our newly created bin will be listed with the information discussed previously. The most important column for us is the Request URL which is the URL of the endpoint for that bin. This endpoint will allow us to point our SignalWire phone number to a bin. Clicking the icon next to this URL will copy it to your clipboard.

A screenshot of the created bin. The newly created bin is visible. The request URL appears next to a copy icon, which is circled in red.

Using our New Bin

Now that we have created a bin, we need a phone number that will point to our bin. If you need to purchase a phone number, we have an awesome guide to Buying a Phone Number. Once you have done that, we can navigate back to our Phone Numbers tab in the dashboard.

A screenshot of the Phone Numbers tab in the SignalWire Space. The Purchased tab is selected. A phone number is circled in red.

Here we will find a list of phone numbers we own, as well as our Verified numbers and a few other tabs.
Each phone number listed will have a Name which is a friendlyname attribute that can be changed to help keep track of your numbers, the Number which is the actual phone number, and the Capabilities. Most numbers by default are capable of Calling, SMS, MMS, and Fax.

Clicking on the 'Name' of the phone number will allow us to view more information about the number.

Here we can view the Type of phone number, the ID, Throughput, and the Next Billed On date.

Our goal is to point this phone number to the XML bin we have created, and do to that we will navigate to Edit Settings

A screenshot of the details page for the selected phone number. The 'Edit Settings' button is circled in red.

Once we are here we can set a 'friendly name' for our number.

Under Voice and Fax settings, we can set Accept Incoming Calls As to Voice Calls.

Next we can set our Handle Calls as LaML webhooks.

Finally, we can paste the endpoint URL of our bin into the When Calls Come In text box.

A screenshot of the Number Settings page. Under the Voice and Fax Settings header, the 'When a Call Comes in' field is circled in red. The LaML bin URL has been pasted in this field.

If your phone number handles SMS instead of calls, simply scroll down and follow the same steps in the Message Settings category.

A screenshot of the Message Settings category. 'Handle Messages Using' is set to LaML Webhooks, and the LaML bin URL is pasted in the 'When a Message Comes In' field.
caution

The XML bin we created provides a <Say> response that will not work with SMS. In this case the LaML bin will simply take the inbound SMS, and mark it as processed.

Wrap Up

This guide has hopefully offered a step-by-step walkthrough for you to create and use your first XML bin! While XML bins are not as feature-rich as a hosted web application can be, they are a great starting point and provide powerful server-less implementations for basic call, SMS, and fax handling.

Resources

Now that you understand how to create and use XML bins, it is time to try it out!

For some practical examples:

More advanced users may be interested in creating dynamic XML bins with Mustache Templating.

Sign Up Here

If you would like to test this example out, you can create a SignalWire account and space here.

Please feel free to reach out to us on our Community Slack or create a Support ticket if you need guidance!