Utilizing SignalWire's Serverless XML/LaML
Overview
SignalWire offers server-less XML bins which can be used to create powerful tools to handle calls and messaging. This guide will help you understand what XML bins are, how to create them, and how to use them with your SignalWire phone numbers.
What are XML bins?
XML bins, sometimes referred to as LaML bins, creates a URL endpoint that responds with a set of instructions that can be executed to handle calls, sms, or fax. For a more in-depth look at what LaML bins can be capable of, please check out our XML quick-start guide HERE
What Can I do With XML Bins?
XML Bins are great tools, but 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, ect." will require using one of our SDKs and hosting the code on a server instead of using bins. Click here to see an example of <Gather>
using simple logic LaML Bins can handle and the type of logic that would instead require hosting your own code.
What is the difference between Webhooks and XML bins?
Webhooks pass requests to a web application which 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 HERE
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 programatically (more info HERE), this guide will walk you through XML bins via the SignalWire dashboard. For additional information on navigating your dashboard, please check out our quick-start guide HERE.
Navigating the SignalWire dashboard.
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.
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.
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.
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!".
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 as 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.
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 that you can check out HERE. Once you have done that, we can navigate back to our Phone Numbers
tab in the dashboard
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
Once we are here we can set a 'friendlyname' 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.
If your phone number handles SMS instead of calls, simply scroll down and follow the same steps in the Message Settings
category.
response that will not work with SMS. In this case the LaML bin will simply take the inbound SMS, and mark it as processed.
The XML bin we created provides a
Recap
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!
Our full XML documentation can be found HERE, and Additional Quickstart resources can be found HERE.
For some practical examples, check out our guide for Message Forwarding with XML HERE, our Call Forwarding with XML guide HERE, or our Simple Voicemail with XML guide HERE!
More advanced users may be interested in creating dynamic XML bins with Mustache Templating, or you could put your new knowledge to work with our Morse Code guide!
Finished!
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!