PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Twilio in Two Minutes

Note: This article was originally published at Planet PHP on 7 December 2011.
Planet PHP

I love Twilio. If you're not familiar with Twilio and the amazing voice and text messaging stuff you can do with it, you're in luck! I'm going to show you a few things you can try in a matter of minutes.

An emergency line for the kids

For $2 per month, I set up an emergency toll-free phone number for my kids. They can call this number from any phone, anywhere in the US, for free. The toll-free number will ring my phone, then their dad's phone, then their grandparents' phone, and if all else fails, then a neighbor's phone. It will try each phone number until it finds one that answers. Basically, the kids can call this one number when they urgently need to reach one of us, and they won't have to remember a bunch of phone numbers. They also won't need any money. $2 per month is not a lot to pay for my own peace of mind. Setting this up was easy; here's how I did it.

First, make sure you have a Twilio account and somewhere to host your files. I use Engine Yard's Orchestra PHP platform and GitHub, but you can use whatever works for you.

To make the app, you'll first need the Twilio PHP library.

If you want to copy and paste some PHP, you can either use the Find Me Twilio Twimlet or the Call Screening guide in their list of HowTos, depending upon what you want to do. You can also avoid writing your own PHP entirely by using the hosted Find Me Twimlet, but you have a little less control.

If you want to make everything from scratch, feel free. There are numerous Twilio Quickstart Guides.

Make sure you modify the PHP to include your own phone numbers and Twilio account information ($id and $token), and upload it to where it's being hosted.

Next, get a phone number from Twilio, and provide the URL of where to go when that phone number is called (where you just put your code). The number is now ready to be used!

I think this idea is not only good for young kids, but also for teenagers and even college kids. And, what about aging parents or family and friends traveling around? Knowing they can always call a toll-free number and get help if they need it is something that should make everybody feel better.

Personal messages from afar

My Dad turns 70 this January. I thought it would be kind of awesome to get quotes from some family and friends that he hasn't seen in a while. The only problem is that he has friends all over the world, and a lot of them aren't too tech savvy. They can sometimes use email, but they don't know about Facebook, Twitter, or even Microsoft Word.

I came up with the idea that I could get them to record a small message for him to wish him a happy birthday, burn all the messages onto a CD, and give it to him as a gift. Hearing someone's voice is much more personal than an email or card, and this will be one gift that he will always remember. Because many of them don't know how to record something, I needed to make it easy for them to record a message for him and send it to me.

Twilio makes this super easy!

  1. Get a Twilio account. (You don't need anything else, unless you want to make this more robust and do more things.)
  2. Check out the Voicemail Twimlet. Give it the parameters you want, then grab the URL that is generated.
  3. Get a phone number from Twilio and in hook it up to the URL the Twimlet just returned.
  4. Distribute the number with an explanation of what it's for. When someone calls, they will be prompted to leave a message, and you will get an email with a link to an MP3 of that message.
  5. As emails come in, you can follow the link and grab a copy of the message they left, download it, and then burn them all to a CD.

I think this also would be cool for aoget wella messages for a hospital-bound friend, or a loved one that is stationed overseas. Responses could be sent to them individually, or to someone else who could compile them first.

Basically, there is no limit to what Twilio can do; the only limit is your own imagination. Go check out their Quickstart Guides, their "/

Truncated by Planet PHP, read more at the original (another 907 bytes)