Basic Twilio Tutorial

I’m sure some of you have already heard about Twilio around the office or from programming friends. Twilio is an amazing application that allows automation of SMS and voice calling. It can be used for countless different applications, especially for technical support with clients.

We empower developers to build powerful communication. Twilio powers the future of business communications, enabling phones, VoIP, and messaging to be embedded into web, desktop, and mobile software. We take care of the messy telecom hardware and expose a globally available cloud API that developers can interact with to build intelligent & complex communications systems. As your app’s usage scales up or down, Twilio automatically scales with you. You only pay for what you use – no contracts, no shenanigans.

I think Twilio is awesome, and it can be used in so many different ways. For this tutorial I will show you how to get started and the basics of what you can do with Twilio, mainly in a simple customer service application that forwards clients support SMS’s to your email.

If you use Zendesk as your customer support platform, you can forward these to the Zendesk support email which will make the requests automatically appear in Zendesk!

To start out, go to Twilio and make yourself an account. Go to the Twilio Website and click the button that reads “Sign Up For Free”. Enter your credentials and then you will have an account.

When you sign in, you will be met with the following screen:

Here you need to note your Account ID and Auth Token. These are what you need to have in order to run your application on your own webpage. Before we are able to do that, we need to make sure your Twilio account is setup to point to your script.

In order to send SMS to your own script, you need to put some money on your account and buy a number. I know spending money is never fun, but it has to be done. Once you have bought your first number, click the Numbers tab on the top of the Twilio menu.

When you reach the numbers page, click on the number you want to modify. This will bring you to a settings page for that number, where you can change your Messaging Request URL. In that field you will want to type the location of your script, so something like “http://yourcompany/twilio-script.php”. I also use POST rather than GET for the type, just so all the settings are the same.

Now its time to start making the application. First download the “twilio-php-master” folder from Twilio and put it somewhere accessible by the script. Once that is done we can start writing the “twilio-script.php” file.

Let’s start by getting all the information we can from the sender.

Now with this information we can essentially do whatever we want. This is the beauty of Twilio, its so simple. We can now email the SMS to our Zendesk support email so it will appear directly in Zendesk:

And as easy as that, you now have a working SMS support application that works with Zendesk. But what if you are looking to send the person a SMS back to notify them that their support request has been received? Easy!

And that’s all there is to it. That’s about as simple a rundown of Twilio that you can get, showing you the basics that you can then use to do whatever you want. You can use this information to expand your own applications as much as you want.

I’ve used Twilio for a Fantasy Draft application that a couple of my friends and I made for our Fantasy Hockey League. When it was someone’s turn to draft, we would send them a SMS with a link that would automatically log them in, and of course the site was mobile friendly so they could draft from where ever they happened to be. It was awesome to be able to do everything without having to gather everyone together which can be very tricky. This is just one example of how you can use Twilio, but the possibilities are truly endless.

As always thank you for reading and please share it around as much as you can! Please feel free to put any questions, suggestions, or ideas in the comments section below.