February 09, 2016

Before cell phones, there were only landline phones. In high school, I frequently called the person I had a crush on at home. Calling a semi-private phone number to have private conversations was always a rough time. I hoped against all odds that my crush would be the one answering my call and not their parent or sibling. Awkward conversations with disapproving fathers were plentiful in this landline era.

I don’t want to relive the existential dread of those phone calls. But, I do want to use a phone call as a means to unlock nostalgia and coding skills. Fire up Terminal and break out your mixtape CDs. We’re building EmoPhone, a Twilio-Powered IVR that plays emo music using PHP, and ngrok.  Try it out right here: +1 504-684-7369

Toolbox Checklist

Before we get going with the tutorial (and a litany of references to my favorite emo bands) let’s run down the tools you’ll need to build an IVR in PHP.


Getting Set Up With Twilio and ngrok: Signals That We Send Over The Air And Through A PHP Server

Let’s say one of my emo-band buddies calls EmoPhone once it’s complete. In a perfectly engineered world, they’ll hear a greeting, then a list of emo songs to choose from. Once a selection is made, the song will play. Before we get coding, let’s get our house in order.

If you’re new to Twilio, you’ll need to create an account and buy a phone number. You can search for a number with the area code of your choice, or a number that contains a phrase you like. I searched for a phone number that has the phrase “emo” in it.

Here’s how you do that in GIF form.


Next, download ngrok. If you needed some convincing on why we’re using ngrok, check out these 6 awesome reasons to use it.  It’ll help Twilio access the code we’ll write, and the tunes we’ll play. ngrok lets you expose local files to the world via a URL. We’ll use ngrok to give Twilio the URLs it needs to execute our code and make the EmoPhone run smoothly.

Let’s create a folder where we can keep our code. Open up Terminal and enter

cd Documents
. Then write the command
mkdir Hacks
. This will make a folder in your Documents directory called Hacks. Now we have a place to store the first bit of code we’ll write, and a place to store the code for your other future projects.
Now let’s solve the the Zoolander problem. Namely, the files we’ll create are on your computer and Twilio has no way of accessing them. Fire up a server to expose our code to ngrok. Make sure you have PHP 5.4.0 or later installed so you can get a server going with the following command. Double check you’re in the directory Hacks, then enter
php -S localhost:8888
into terminal. Your server should be up and running. Then cd to the directory where you downloaded ngrok and input
./ngrok http 8888
You should see this.


Excellent, our development environment is set up and we can write some code.

Say It Like You Mean It

First impressions count. We have to greet the caller before we get to riding phone lines and playing jams.

The first piece of code we wrote will feature XML commands we call TwiML. These are XML verbs that instruct Twilio to do things like record calls, play files, respond with text to speech and a whole lot more.

This file will handle the incoming call and greet the caller. Create a file called

. We’ll then paste the following code into that file. Here’s what it’ll look like:

      Welcome, We hope you are having a very sad day. Please choose from the following list of early two thousands eemoohh jams
      To hear You Know How I Do by Taking Back Sunday, please press 1.
      To hear Jude Law and A Semester Abroad by Brand New, please press 2.
      To hear You Vandal by Saves The Day, please press 3.
      To hear Alive With The Glory of Love by Say Anything, please press 4.
      Sorry, it looks like you did not select a sad song. Please select one

Try calling your app. You should hear Alice (Twilio’s lovely TTS robot) reading the greeting prompt. When you input a digit, you should hear an application error.

Now, let’s break down what each verb in that snippet of code is doing

  • <Response>  – Twilio wants something from our server, namely, our TwiML file. This verb lets Twilio know we hear it loud and clear, and we are responding to the request.
  • <Say> – dictates the words you’ll say to the caller via our lovely TTS bot, Alice
  • <Play> – this verb let’s you play an audio file to the caller. A bit later we’ll use it to play sad jams, and in this case, we’re playing the recorded intro I provided for Emo Dial.
  • <Gather> – this verb rounds up all the data your user inputs via pressing 1, 2, 3 etc in their song selection.

Open your browser and go to

. You should see your pretty XML file.
xml localhost

With this code in place, our caller is ready to select a song from Taking Back Sunday, Brand New, Say Anything, or Saves The Day. Are we ready to play it? Not quite yet, but we’re getting there.

Oh, Hello

Now we have a means to share our code with the outside world of APIs. But we still have to figure out what we’ll tell Twilio to do with those songs, how to handle user input, and how to <Play> the songs the user selects.

Your caller is no longer a mystery man. You now know which song they want to hear because they made a selection. The <Gather> and <Play> verbs will help us instruct Twilio how to handle the selection.

Twilio needs to <Gather> the user’s input which will then be passed to the ‘handle-user-input.php’ file. That ‘handle-user-input.php’ file will trigger an action, telling Twilio to play the song associated with the user’s input. Before getting into that, we’ll add the necessary TwiMLto incoming-call.xml right before we <Say> anything to the user.

Our updated XML file will look like this. You can see the changes on line 4 and line 11

    Welcome, We hope you are having a very sad day. Please choose from the following list of early two thousands eemoohh jams
    To hear You Know How I Do by Taking Back Sunday, please press 1.
    To hear Jude Law and A Semester Abroad by Brand New, please press 2.
    To hear You Vandal by Saves The Day, please press 3.
    To hear Alive With The Glory of Love by Say Anything, please press 4.
  Sorry, it looks like you did not select a sad song. Please select one


Believe In What You Want From PHP

Thank you XML. You’ve done a great service, but if we’re talking to servers and handling unpredictable user inputs, we’re going to need a more dynamic coding language – PHP.

XML is a static language. It can relay our greeting to our caller without a hitch because we’re delivering the same greeting every time. Our user won’t be selecting the same song every time unless they’re a huge Brand New fan. Nevertheless, we can’t bank on that so it’s on to PHP.

Put your trust in simple acts, they’ll carry the weight of what we want out of our PHP file. For example the variable the <Gather> verb is huge in this file. So is the variable $digitPushed. That variable contains the data of what we’ll <Gather>, namely, the digits the user pressed.

Now Twilio knows which button the caller pressed courtesy of PHP passing that info along. But Twilio doesn’t know what to do with it. In this following snippet of code, we’ll spell out what Twilio should do with each of the 4 song selections by using switch statements in PHP.

Playing The Songs

You’ll want to host your songs in the same directory as all your code. This way when Twilio goes looking for that mp3 file to play, it’ll find it in the directory that ngrok is exposing via a url. Add the ngrok forwarding url with the filename of the song you want to play into the <Play> fields in your php file. My ngrok forwarding url is http://emophone.ngrok.io. The file I want to play is TakingBackSunday.mp3 so I would drop http://emophone.ngrok.io/TakingBackSunday.mp3 in the first play field. I’d do the same for the other songs I want to play.

Name this file


    #Your Ngrok Forwarding URL #/TakingBackSunday.mp3
    #Your Ngrok Forwarding URL #/BrandNew.mp3
    #Your Ngrok Forwarding URL #/SavesTheDay.mp3
    #Your Ngrok Forwarding URL #/SayAnything.mp3

Our jams are online, let’s take this EmoPhone home.

If It Makes You Less Sad, We’ll Start Sharing This With The World

The code is written. The server is fired up. We’re peeling off Exit 152 and getting close to home. Now we need to point Twilio to our ngrok forwarding url. Go back to your Twilio dashboard and tab over to “Voice” There you’ll see a field for Request URL. Copy the forwarding URL from ngrok and drop it in the Request URL field for your Twilio number, add the file extension then hit save.


Tell All Your Friends

Your app is online! It’s playing music! It’s in the world! YUSS.

To butcher the words of one Adam Lazzara:

You can tell all your friends
To put the phone to their heads
This all was only wishful tinkering
This all was only wishful tinkering
(the only thing that I regret is that I, I never let you call me back)

Now that you have your first Twilio powered IVR up and running you can customize it however you please. If you’re not a fan of emo music, make an Adventure Time FAQ hotline. You can make a IVR with your favorite quotes from The Office, you can get incredibly meta and make an IVR that tells stories about your favorite IVRs! The possibilities are endless.

If you’re looking to expound upon the IVR hackery you’ve learned, check out the few posts below and please hit me up on twitter. For questions or comments above 140 characters, shoot me an email at kyleky@twilio.com. I’m all ears, especialy if you have ideas for new emo songs to add, any questions to ask, apps to share, or hacks to hip me to.


EmoPhone: How To Build A Twilio-Powered IVR Using PHP and ngrok

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

The Marchex Institute recently studied more than 4 million phone calls placed from consumers to businesses between 2013 and 2015, using technology that automatically monitors speech, silence, ring tones, and hold times, to uncover speech patterns from residents in all 50 states. The company used that data to identify the states with the fastest talkers, […]

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

By Joan M. Brennan, guest blogger.Joan Brennan Photo

Joan Brennan is the owner and CEO of Brennan Innovators, LLC, creator of low-tech & digital tools for challenged readers, notably the Reading Focus Cards. She is also the College for Kids Instructor at the St. Louis Community College-Meramec.
Contact Joan at joan@focusandread.com and on Twitter @FocusAndRead

Educators know that getting and keeping students engaged in a lesson is challenging, but it is also key to learning success. Incorporating different kinds of strategies into a lesson plan will go a long way to ensure a higher level of student engagement, especially when these methods appeal to one or more of the students’ five senses. The more senses involved, the better the engagement, mastery level of the content and the retention thereof.

In our world of education today where technology has become an integral part of learning, one might ask, how can I develop “sensory” units of study when so much of what we do in the classroom involves computers and tablets?

Here is a list of 13 ways to incorporate low-tech, high-tech and sensory strategies into a unit of study:

  1. Allow for the recording of oral notes from an online lesson with a micro-cassette recorder or other inexpensive recording device. When a main idea is presented in the digital text, it can then be recorded for future reference. The essential points that support each main idea should also be recorded as they are discovered in the text. Play back the oral notes for a variety of further study activities: to help create more accurate written notes, to facilitate in writing an essay, to review content at test time or to share with a study group. This is a good strategy for auditory learners.
  2. Arrange for all course and book content to be made available via audiotape or CD. This will be another very helpful strategy for students who learn best by listening.
  3. Use sensory-appealing tools to help isolate 1 or 2 lines of text for individuals with focusing challenges. These types of tools can help visual as well as tactile learners with their use of color, soft materials and other features. Many students can easily be overwhelmed by too much text on a computer, e-reader or tablet screen. For such an issue, a student might use these physical tools to help focus on each line of text and block out a large amount of surrounding text on a screen. This approach can make reading assignments much more manageable, breaking down the content into chunks or small sections.
  4. Allow for access to a copy of prepared notes, especially after an online lesson or presentation. This will give students the benefit of knowing which ideas and points are important in a unit of study for an online lesson. This can be most helpful to students with attention and focus issues, writing challenges such as dysgraphia or other difficulties.
  5. Provide stick-on notes for writing down main ideas from a lesson or study unit. Then allow for them to be placed on a wall at eye level. This is an effective strategy for visual learners and/or individuals with executive function challenges (memory, etc.)
  6. Allow for the use of colored paper for handwritten and printed materials including worksheets, outlines, notes, etc. Experiment with pastels as well as bright shades. One particular color may produce significant results for each individual reader. White page backgrounds with black text in particular can cause “visual stress” for more than a few readers.
  7. Along the same lines, consider the use of anti-glare computer screen filters and/or colored screen overlays when reading online content. These can decrease visually-offensive glare often caused by overhead florescent lighting, increase focus, diminish “visual stress” and help lengthen online reading and working periods. It is also recommended that appropriate colored overlays or films for smartboards and dry erase boards also be used for these purposes.
  8. Allow for some kind of movement when reading online content. Also, permit kneeling or standing at a computer desk (if needed), as long as it does not cause problems or distractions for others. A standing computer desk can be a huge benefit to a kinesthetic learner or to an individual with ADHD. For an even lower-tech idea, consider attaching a “soundless” elastic band or bungee cord across the 2 front legs of a non-rolling computer chair. While seated and reading online, this will allow for feet to move within a small space and can be helpful for children who must “fidget” to focus. Stress balls can provide another option or additional support for some learners.
  9. Consider adding 1 or more therapy balls as another seating option for students, as they work with computers or other tech devices. These types of balls strengthen core muscles and can be very therapeutic for kids who need to wiggle. These also can help develop proper posture, improved sitting habits and are good for childrenwith sensory needs.
  10. Permit the use of very low-volume music (instrumental) or environmental sounds (seashore, birds, etc.) while doing independent work online. Be sure to provide headphones in a classroom setting for this strategy, of course.
  11. Allow students to work cooperatively with others at times as part of a “buddy” system of support. This can be an excellent strategy for interpersonal learning styles. Some students simply need to talk and interact in order to learn and retain information successfully.
  12. Utilize text-to-speech technology, especially for students with reading challenges and for individuals who are auditory learners. Listening while reading to a text at the same time can greatly increase reading comprehension. This can be a particularly good strategy for students with dyslexia or those with low vision.
  13. Seek out and implement the use of effective software applications to better enable individuals to focus and read digital media with more success (whether online or offline).

With these tips in mind, you can begin to incorporate and discover the right match between tech tools and a student’s needs. It may take some time and effort, but the appropriate combination of assistive technology tools and tips can be instrumental in helping a student become a much more successful and independent learner.



ReadSpeaker: Use the power of ReadSpeaker text-to-speech to give a voice to your websites, mobile apps, digital books, e-learning materials, documents, and more!

Brennan Innovators, LLC: Strategies & Accommodations for Challenged Readers


Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

February 08, 2016


In 1950, Alan Turing posed an interesting question: can machine intelligence become human-like enough that the average person would not be able to distinguish the difference between man and machine? Thus, the Turing test was born. Turing explains the test using a scenario in which a human interrogator asks questions of two parties, of which one is a human and the other is a machine. Knowing that one is human and the other is not, if the interrogator can’t reliably determine which is which, the machine is said to have passed the Turing test. There is a variety of Turing tests, but all contain text-only interrogations; a robotic voice is simply too much of a giveaway. While we now refer to these intelligent machines as artificial intelligence (AI), the Turing test remains relevant.

The application of artificial intelligence to self-service seems like a match made in customer service heaven. Customers like and prefer self-service options, while artificial intelligence capabilities allow machines to perform complex tasks better and faster than humans ever could. Some of the more advanced automation incorporates AI into self-service channels, commonly including the web, chat, and phone, among other channels. And as AI continues to improve across more applications, companies are feeling the pressure to utilize its capabilities in a way that both benefits their customers and saves money.

For certain self-service channels, like web search, there obviously isn’t a bunch of really smart guys on the other side of the search bar scanning the internet as fast as they can for what we need. But for the channels that are more conversational in nature, such as phone, chat, or text message, there’s always the chance that the first contact might be with a machine. In other words, each time you initiate communication in one of these channels, you’re the interrogator in a Turing test of your own. These channels, when not being operated by a live agent, likely employ some type of AI to provide relevant responses and maintain the conversation.

Pretty cool, huh? Well, there’s a problem with blindly advancing artificial intelligence. The reality is, as a certain technology becomes more and more human-like, it follows a trajectory similar to a power function (high school algebra, anyone?). At a certain point, the humanness becomes creepy and unsettling – it’s human-ish, but something feels off. Think Ava from the movie Ex Machina. The emotional discomfort we feel when this happens is known as the Uncanny Valley.


As you can see, there are two peaks on the graph, with the second peak representing a point of technology that we haven’t yet reached. And since we’re not at the second peak technologically, you shouldn’t go over the first one. The idea is, we want to stay at the first peak and advance it as much as possible, without falling into the Uncanny Valley between the two peaks. A recent recap article of Call Center Week in Orlando mentioned “humanizing [self-service] technology” as a key focus for attendees. There are a lot of ways to humanize technology – i.e. using 100% natural language, and referring to customers by name – while keeping it on the first peak and out of the Uncanny Valley – i.e. keeping familiar robotic voices rather than using voice talent.


When you account for the Uncanny Valley, passing the Turing test becomes a challenging balancing act for companies who employ smart customer service technology. Sure, you want to use advanced technology for great service that is comparable to a live customer service rep; but you definitely don’t want to creep your customers out!


As you evaluate your current and future self-service technologies, especially those that involve some form of artificial intelligence, keep in mind the fine line between the Turing test and the Uncanny Valley. The million dollar question is: how can you continue to push the peak before the Uncanny Valley higher? The future will undoubtedly bring more self-service options, powered by AI, that are much improved and sit atop a higher peak than today’s channels. Start implementing AI into your contact center now, and you’ll be able to stay relevant as the future arrives.

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

At Twilio, 77% of all requests to our REST API are made by a helper library user-agent. It’s the most common touch point between Twilio and you, the developer.

That’s why we’re so excited to announce early access to the next generation of our Python and Ruby helper libraries. These next-gen libraries are built on a new API auto-generation tool, homegrown within Twilio, designed to make all future helper libraries a whole lot better.

As Twilio has grown, introducing new products like Video, IP Messaging and SIP Trunking, our API surface has grown as well. Twilio’s first helper libraries were written in only a few languages, and supported only 12 endpoints. We now support 8 subdomains and over 200 endpoints in 7 languages: C#, Java, Python, PHP, Ruby, Node.js and Salesforce. Manually generating all of these libraries at the level of excellence developers have come to expect from us has become a daunting challenge.

We found that the best way to address this challenge was to introduce a healthy dose of automation into the process. We were inspired by projects like boto3, raml-codegen and swagger, which auto-generate API code and documentation. All of these projects have shown that generating helper libraries off of declarative definitions can be effective and maintainable.

Following their lead, our in-house solution allows us to almost completely auto-generate our helper libraries. We’ve kept in a few layers of manual configuration and optimization. This approach allows us to continually improve our helper libraries at scale while maintaining the human-friendly, “hand-crafted” feel that developers come to know and love as a distinctive mark of Twilio’s helper libraries.

Advantages Of Automation

In a nutshell, automating our library generation allows us to improve the developer experience and increase the pace at which we iterate. It means we can bring you new features and languages much faster than when all of our helper libraries were manually generated. Additionally, we’ve taken the opportunity of re-architecting our libraries to make several enhancements including:

  •   Optimized network efficiency (Make fewest number of REST calls necessary)
  •   Configurable page sizes for memory efficiency on constrained devices
  •   More consistent feature coverage across different languages
  •   Language idiomatic ways of expressing constructs (So C# feels like C#)
  •   Streaming Auto-Paging (my personal favorite new feature)
  •   Proper type serialization/de-serialization
  •   BYOHC (Bring Your Own HTTP Client)

With every engineering decision there are always tradeoffs. In order to gain these advantages we’ve had to trade backwards compatibility and simplicity in our community contribution model. Today, with this early release, we’re simply providing a summary of what to expect when our new auto-generated libraries become official later this year. Over the coming weeks you can expect more detailed blogs posts on specific features and how to contribute updates to the new auto-generated libraries. We’ll also soon be publishing release candidates for Node.js and PHP, followed by C# and Java.

We Need You

To get started visit the installation and migration guides linked below. We’d love to hear your thoughts on the release candidates of our Python and Ruby libraries. You can get support and provide feedback by opening an issue on Github and tagging the issue with “release-candidate”. Our engineering team monitors the issue and is looking forward to hearing from you.



Introducing Twilio’s Next Generation Helper Libraries

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

February 05, 2016

Twilio Lookup is a simple REST API with a ton of utility. You can use Lookup to check whether a number exists, format international numbers to local standards, determine whether a phone is a landline or can receive text messages, and even discover information about the carrier associated with that phone number.

In this post, we’re going to learn how to deal with valid and invalid numbers using the Twilio Python library. This code could work in any context whether you use it to look up customer numbers in your production Django app or just have a basic script you want to run to check numbers in a local database. This should also work regardless of whether you are using Python 2 or 3.

Before getting started you will need to have Python installed as well as pip, which should come with most versions of Python. You will also need to sign up for free Twilio account.

Getting started

First off you should run a virtualenv in order to cleanly install python libraries with pip. If you are unfamiliar with pip and virtualenv you can check out this guide.

Head over to your terminal and install the Twilio Python module:

pip install twilio>=5.0.0

You will also need to have your Account SID and Auth Token handy, which you can grab from your Twilio account dashboard.


Now take those values and set them as environment variables:

export TWILIO_ACCOUNT_SID='Replace this with your Twilio Account SID*'
export TWILIO_AUTH_TOKEN='*Replace this with your Twilio Auth Token*'

With these set as environment variables, the Twilio Python module will be able to access them so you don’t have the problem of accidentally committing your account credentials to version control. You can also check out this guide on managing your environment variables.

Looking up valid phone numbers

You can check out the Lookup page if you want to play around with the API and see what type of data a request will return. Try entering a phone number and take a look at the JSON response object.

Here’s a quick code sample for that type of lookup without getting the carrier information:

from twilio.rest.lookups import TwilioLookupsClient

client = TwilioLookupsClient()
number = client.phone_numbers.get("15108675309")
print(number.national_format)  # => (510) 867-5309

This basic functionality is free, but you can get more information by doing a carrier lookup, which will not cost much. Carrier lookups are commonly used to determine if a number is capable of receiving SMS/MMS messages.

Carrier lookups contain much more useful information, but require an extra parameter:

# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.lookups import TwilioLookupsClient

# Your Account Sid and Auth Token from twilio.com/user/account
# Store them in the environment variables:
client = TwilioLookupsClient()

number = client.phone_numbers.get("15108675309", include_carrier_info=True)
print(number.carrier['name'])  # => Sprint Spectrum, L.P.

Looking up invalid phone numbers

You can think about Twilio Lookup as a phonebook REST API. In this “online phonebook” the phone numbers serve as a unique ID. When you try to look up a phone number that does not exist you will get a 404 response.

Head over to the Lookup homepage again to see this in action when you check a number that doesn’t exist:


When the Twilio Python library encounters a 404 it will throw a “TwilioRestException”. If you change our current code to look up an incorrect phone number you will see this in action:

Screen Shot 2016-02-01 at 4.42.10 PM.png

The error code for this is 20404, so if we want to write a function that validates phone numbers we can check to see if an exception was raised with code 20404.

Create a file called “lookup.py” and try this code out:

# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest.lookups import TwilioLookupsClient
from twilio.rest.exceptions import TwilioRestException

# Your Account Sid and Auth Token from twilio.com/user/account
# Store them in the environment variables:
client = TwilioLookupsClient()

def is_valid_number(number):
        response = client.phone_numbers.get(number, include_carrier_info=True)
        response.phone_number  # If invalid, throws an exception.
        return True
    except TwilioRestException as e:
        if e.code == 20404:
            return False
            raise e

print(is_valid_number('19999999999'))  # False
print(is_valid_number('15108675309'))  # True

You now have a function you could use anywhere in your code for validating phone numbers.

Looking ahead

So now you know how to use the REST API phone book that is Twilio Lookup. You’ve used it for validating phone numbers, but you can also do cool things like phone number formatting and checking to see whether a number can receive text messages or not.

You might want to use one of these more common cases, but I’m always excited to see what other crazy ideas people think of with new APIs. I cannot wait to see what you build with Twilio Lookup.

If you have any questions or want to show off what you built, feel free to reach out:

How to Verify Phone numbers in Python with the Twilio Lookup API

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

In 2016, we are reticent to put a ring it. Spotify, Netflix, Hulu, and HBO commitments all come

with a caveat — we can leave at the end of the month. The problem is it’s easy to lose track of the commitments we make, and the monthly fees we incur to as serial subscriber to all sorts of platforms.

The subscriptions quietly snowball, unbenounced to the subscriber. Trim performs an audit of your credit card, texts you a list of your subscriptions, and lets you cancel whichever you choose via text. There’s no app. There are no downloads. There’s only a text.

Daniel Petkevich, co-founder of Trim, remembers showing Trim to his Dad. More accurately, he remembers his Dad saying he wouldn’t use Trim because he didn’t have any unnecessary subscriptions. Minutes later, Daniel’s Dad was on the phone trying to dig up details on an Experian membership he didn’t know he had. That’s a microcosm of what Trim aims to do – watch out for the consumer.

“We’re moving to a world where more companies have a subscription based model, we want to be customers’ watchdog for that.” says Trim co-founder Daniel Petkevich. If I may abuse that watchdog analogy, watchdogs are easy to command. When you send a text to Trim, it responds by executing your command. The Trim team chose SMS as a medium for their platform because of its simplicity.


“We asked ‘Hey, what would be the easiest way for our customers to interact with our software to cancel their subscriptions?’ I think text is the easiest way to do it. You don’t have to download an app, you don’t have to create an account on the app, you don’t have to use the app. You just get a text and reply ‘cancel this, cancel that,’”said Daniel.

Trim’s on-board process is pretty quick. You enter your name, email, and phone number, and then check for a text (sent via Twilio) with a code you’ll use to authenticate your identity. After that, select your bank and login using your online banking platform’s credentials and you’re done.



Daniel wants to make Trim smarter. It should stay dead simple to use, but continue getting more contextually intelligent. For example, instead of waiting for you to do an audit of your subscriptions and execute cancellations, Trim might proactively look at your car loan and recommend a more competitive rate.

Consider Trim a Sheriff in the Wild West of on-demand, subscription-based businesses. That market is only growing, so Trim plans on getting more intelligent, artificially intelligent that is.
Learn more about Trim right here.

Ghosts of Subscriptions Past: Trim Cleans Up Your Charges Via Text

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

February 04, 2016

In just 16 weeks, SIGNAL is coming back to San Francisco May 24th and 25th. We got a brand new venue at Pier 27, killer new lineup of over 100 speakers, and barrels brimming with new shenanigans we have in store for our favorite shindig of the season. Last year, I shared a few reasons why I thought you should join us at SIGNAL with your whole team of developers.

A whole lot of you did – and what a time we had together. This year I wanted to extend the same invitation, but for a few new reasons. I’m more stoked to see you at SIGNAL and here’s why.

High Signal-to-Noise for Diverse Teams of Software People

We always aim to provide zero-fluff, no-pitch technical deep dives when we ask for your time, and this Twilio tradition continues with the shindig this year. This go-round we steered the lineup to be useful for everyone that works on your software product. With a diverse content set we think will inform the work of every software developer, regardless of where they sit in the stack.

In particular, I’m really looking forward Eileen Uchitelle’s deep dive on the common web vulnerabilities affected modern web apps – practical wisdom for developers on the front-end and back-end alike. We also have littleBits’ Kristin Salomon returning this year – the developer experience she created with cloudBits remains one of my favorite in the IoT space which will inform the work of anyone working in software. I think folks with a devops bent are going to be in for a particular treat with our own Dom DeGuzman’s session – few I know have as much experience supporting as many different stacks in production as she.

Learning New Tricks From Twilio’s Finest Developers

Even after working here for four and a half years, I still learn four or five new ways to use Twilio at SIGNAL. This is the conversation where all the best Twilio hackers come to share what they’ve been working on. The collective weight of their ingenuity and enthusiasm for sharing their work brings new definition to “crushing it.” Many developers I talked to last year share their excitement for a clever Conference hack I’d never considered before or a technique to speed up test suites dramatically.

mRelief started using Twilio a few years ago and have amassed a ton of experience delivering SMS surveys for disadvantaged populations. Their CTO Genevieve Nielsen will be sharing what they’ve learned along the way. We first heard about Tiffani Bell’s work when she joined Code for America back in the summer of 2014. She’s going to share how she’s built an SMS direct assistance network with her Detroit Water Project that has helped 10,000 citizens get their water service restored, full of useful info for anyone building a double-sided marketplace. I’m also way stoked on Lindsey Crocker over at Sparefoot sharing some valuable time savings you can engineer into your customer support call-in experience. My colleague and comrade Gowri Grewal has seen nearly every scale Twilio implementation there is – her talks are always on my can’t-miss list.

I think every time I go into our big annual get-together I think I know all there is to know about hacking on Twilio. That notion usually evaporates around 1pm on the first day.

First Dibs On The Cutting Edge

developers2Last year, SIGNAL attendees were the very first with hands-on experience with Twilio Video and were the first invites sent when Twilio IP Messaging hit beta. In May, the community at SIGNAL will get similar first crack at the new product from Twilio. We have some crazy surprises in store that we can’t wait to share.

We also aimed to extend that cutting edge to the folks we invited to SIGNAL to talk. The slate of technologists we have coming in May represent a cadre working on the absolute cutting edge of every relevant trend in programming. JavaScript slinger and fellow New Yorker Sara Chipps will be by to share the remarkable education experience she’s created for young girls learning to write code with her company Jewelbots. We have Leah Culver back who never fails to drop only the freshest iOS knowledge every time she rocks the microphone. And I can’t wait to meet Katy Moe, a literal cyborg who is going to set a new bar in live coding by programming herself onstage.

The Most Fun You’ll Ever Have Coding

developers3I hope you don’t think I’m immodest when I suggest $bash last year was the wildest developer experience I ever got to join. Reimaging Coney Island for coders set a high bar; our earnest ambition is to top Twilio’s true festival of code with a brand new experience for every single one of our 2,000 attendees. We’ve long rejected the false dichotomy of “conference time” and “party time.” We think what we have in store for $bash in May 24th and 25th will again reset your expectations of technical conference nightlife.

You’re going to have a serious blast. And you’re going to cut some code while doing it, regardless of whether or not you have before.

You’re Going To Be There

The most powerful outcomes I’ve seen come from the annual congregation of the Twilio community were almost always a result from the full team being there together. At our annual get-together, I’ve seen new companies sketched out on the back of cocktail napkins who demonstrated at our Community Hall the following year. I’ve seen teams ship completely new experiences that pulled the trajectories of their businesses from a tailspin in two short days. I’ve seen teams kick out prototypes that that led to new products that they never would have considered shipping if it weren’t for those two days at SIGNAL.

This environment, this information and – most importantly – this community combines to create something I haven’t seen before in software.

I hope to see you and your team on Pier 27 in San Francisco. We know how big the opportunity cost is bringing your team out – if you have a group of five or more, use the code Spectre20 to get 20% off each individual ticket. If you have a whole mess of people coming we have group discounts up to half off for 10 or more people – just call 415-446-7731 to get sorted right away.

We got a lot of craziness in store – I hope I get to meet all your developers in May.


5 More Reasons You Should Bring Your Engineers To SIGNAL

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Today, we are happy to introduce volume pricing for call recording storage. This means that, as your volume grows, you will be charged less and less per minute to store recordings. Don’t worry if your volume is still low, the first 10,000 stored minutes of recordings per month are free for you to play with.

Call recordings are a precious mine of information about your customers. You can use recordings of past calls to analyze product feedback, train agents, get metrics on customer sentiments, enforce compliance, or also transcribe them to run keyword analysis – just to name a few. The more recordings you accumulate, the more accurate the insights will be. This helps your business adjust to customer needs faster, and provides you with valuable data.

There was a time when recording a call meant hooking a cassette recorder to a hardwired phone line. Back then, businesses used recording for compliance purposes, but were reticent to use it as an asset because of storage concerns. The more calls you logged, the more tapes you had to store. Managing that type of tape inventory was unsustainable.

Today, you have two ways you can store recordings.

The first option is to manage recordings yourself. This sounds like the modern equivalent of mining through a pile of cassettes. You have to make an upfront investment in storage, then figure out how to integrate that third party storage with your existing phone system. As you grow your business, you’ll run out of storage, buy more and have to figure out the new integration with your phone system again. Infrastructure maintenance is also a concern with this option. You will have to repeat these steps every time you need more storage. Your complexity scales alongside your business.

The second option is to set up recording and storage in your Twilio app and pay only for the storage you use. There is no upfront investment, no on-premise infrastructure, and no integration finagling regardless of how fast you grow. You have one simple API call to share recordings, transcribe them, analyze them, and listen back to them instantly.

You can focus on getting the most out of your recorded calls. We will take care of the rest.

We want to see you grow by learning more about your customers. Call recording is a valuable tool for your business as you scale. We’ll be scaling right alongside you. We now have bigger storage volumes available at more affordable prices, so you can basically record everything and keep it forever without worrying about the costs.

Here is how the new pricing works. At the end of every month we will calculate your daily average of stored minutes. As your storage grows we automatically apply pricing discounts to each usage tier, no actions needed from your side. You can see the detailed tiers below.


Introducing Volume Pricing For Recording Storage

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Let’s celebrate IP Messaging with an old-fashioned Twilio contest. Spend the rest of the month working on your sickest, most mind-blowing hack and then submit it here. If you use IP Messaging, you’re eligible for the grand prize:

Bonus points for keeping the community updated as you build via tweets, tutorials or Twitch streams.

Looking for inspiration? Check out these posts to help you get started:

Twilio IP Messaging JavaScript Quickstart

Twilio IP Messaging iOS Quickstart

City Chat with Python and Django

Designing Chat Apps for iOS Using Swift

How To Get Involved

Entries must be submitted by 11:59 PM PDT Monday February 29th. Entries must use Twilio IP Messaging. You can submit your entry here. If you need any help, or just want to share your idea, drop us a note on Twitter. We can’t wait to see what you build.

Developer Contest: Show Off Your IP Messaging Hacks

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

February 03, 2016

Patrick McKenzie is the CEO and Cofounder of Starfighters whose mission is to “unbreak dev hiring.” He’ll be speaking at SIGNAL, our developer conference for communications May 24-25th in San Francisco. If you’d like to come to Signal and meet Patrick along with 2000 other developers, register here and use the promocode PATIO11 for $100 off your ticket.

Last week, Patrick graced us with his presence on Twilio Radio. This is a transcript of the latter half of that conversation. Here’s the full audio: 


What is broken about dev hiring?

Many parts about the way the tech industry and many other employers of developers do hiring are unsound, unserious, probably unsafe. There’s many other “uns” you could put in front of them. Unfun. It’s just a frustrating process from beginning to end.

What typically happens is that people are screened into a hiring process on the basis of what’s on their resume. Then some crazy percentage of resumes are discarded at that point and never seen again, no matter how much raw talent the people have. It gets compressed and filtered down into a resume, and then those resumes are screened by, in most cases, non-technical people, just on the basis of the keyword scan. That already throws a lot of the baby out with the bathwater.

Then people are given interviews. The interview process at most tech companies is enormously stressful for the candidate. They’re asked to do tasks which are very unrepresentative of what we actually do as engineers, like, “Oh yeah, you’ve been writing web applications everyday for the last five years. Great. Can you please go up to a blackboard and using chalk write out how to reverse a binary tree?” Which I can guarantee you there is no practicing engineer in the entire United States of America or the entire world whose primary choice for an IDE is a blackboard and chalk, which is not how we operate. It’s like saying, I don’t know, juggle bananas instead of balls. Then just juggle bananas so that we can extract signal about your engineering talent. Has very little to do with the work.

The false positive rate for hiring is absurd. The false negative rate for hiring is absurd. Rather than fixing the underlying problem, people instead make hiring more of a hazing ritual with the idea hopefully discouraging some of the people who would otherwise get through it. This has a variety of negative impacts on the industry. Candidates hate the hiring process. Every company is causing many good candidates who would otherwise interview with that company to not interview with that company, simply because they dread the hiring process so much. People who are incredibly talented get selected out of the process very early on, simply because they don’t have the right university on their resume or because they’re last several jobs don’t read as software engineering jobs. For example, someone who’s spent time in network administration, and then systems administration, and actually has quite a lot of skill in, say, writing Python will generally not receive a call back for an interview at a software engineering position, simply because the people who are making the comparison say, “Oh, no relevant software engineering experience.”

This is crazy. Rather than measuring proxies for talent, [at Starfighter] we just decided to try to measure talent directly. Hopefully we can go to our clients and say, “Look, Matt, for example, is someone we introduced to a client in the last week. I know this person, technically speaking, has never had a software engineering position before. I know they have an educational background which is not associated with many software engineers in Silicon Valley. I know that there is the other thing that people try to hire for is demonstrated experience in open source project. I think there’s a variety of reason why that’s a little bit problematic. We found someone who had a background which is not well represented among backgrounds of people who work at high-flying Silicon Valley startups.

I was able to tell a hiring manager, “Look, I understand just if I start to read through the resume, it doesn’t look like the most promising candidate, but when given a very complicated engineering task, which involved both security research, and then a complicated open-ended data analysis task, they not only successfully solved the task, but produced a deliverable which could literally be published in a research journal, in terms of what the thought process was to do the number crunching and data analysis to find the task, including three different theories of independent approaches that one could take to do the data analysis, given a variety of world preconditions and what that would do to the strength of the analysis that one could perform.”

I tell the hiring manager, “Clearly this is someone who is worth an hour of your time to get together and talk about bringing in for a group internally which does a lot of programming that involves data analysis.” An interview, and I got a call back from the hiring manager like, “So that candidate that you referred to us, yeah. Do you have clones? Can we have 10 of them, please?”

It’s not rocket science. I think that many, many companies could do something similar, if they were willing to take a little bit of a risk with what they do for hiring practices. At the moment, a lot of companies feel like they’re firing on all cylinders for doing the other parts of the business. We’re kind of taking a risk on the hiring process for them.

What should a developer know about job hunting?

I’ll give you my most important piece of advice first. This is something that goes against, I think, a lot of our inculturation. Is that a word? That the expected habits of middle class Americans. That is we think that the job search process starts out by sending a formal application or formal resume into some place which is labeled “deposit formal applications and resumes here”. Then if the company is interested in you, then they take the next step. This is not how people successfully get jobs. Underline that for emphasis. Sending in resumes is not how people get hired for most jobs. What you do instead is find someone within a company who has hiring authority and convince them that they want to hire you. Then the formal interview process starts, but with an internal champion who is invested in bringing you into the company. In many cases, an internal champion who has full or partial decision making authority on the decision to bring you on.

What that looks like in practice is you somehow find that an engineering company is hiring, which by the way, every company that has more than 10 engineers is going to hire engineers this quarter. If you go to a meetup and someone says that they are working on a company that has 30 people on it, they are hiring engineers right now, regardless of what their job site says.

Important lesson number two: you ask them are they team leader or higher in their company. If they say yes, they either are a hiring manager or they know who is the hiring manager. Then you just talk to them like you would talk to any other person, geek out about subjects which are mutually interesting to you, whether that’s Python or MongoDB or whatever it is, ask, “What are you doing with your company these days? Oh, that sounds really interesting. We should talk about that a little more.” Then just try to, at the end of that conversation say, “I really like what you guys are doing. I think I might want to explore being part of it.” Have them get the ball rolling on a job application.

This is something that you’re going to have to do more times than you’re comfortable with, because the job search process should generally be performed in parallel for a few reasons. Go out to meetups, meet people, get introduced to five people who have hiring authority, have five talking dates, turn three of those into ongoing job applications. Then do that the next week, and then do that the next week, and then do that the next week until you find a job which you feel meets your criteria, whatever those criteria are.

People who do consulting or freelancing for a living might realize this is isomorphic to getting consulting engagements. It really is. It’s fundamentally running a sales process for yourself, which is a really weird skill for a lot of engineers, and it’s something that people in our community unfortunately don’t value enough and are often times actively discouraged from becoming better at. It is transformatively life changing if you realize that a job search is not a series of terrible events that just happens to you, but rather it’s an algorithm that you can optimize for.

What should a developer know about salary negotiation?

Every company’s hiring process is a little different, but at some point in the process you achieve something which I describe as “yes, if” rather than “no, but”: “Yes, we want to work with you, if we can come to a mutually satisfactory offer,” which is distinguished from, “No, we don’t want to work with you, but we might work with you if it turns out that you’re disgustingly cheap.”

After you have agreement in principle from the person that is hiring you that, “We want you to work here. What’ll it take to make that happen?” Then and only then do you start talking about money. People will ask you about money and other various negotiation related topics before that in the process. Your job is to stonewall that question. I know many developers don’t exactly have huge reserves of internal confidence, which is okay. Fake the confidence here. If they say, “What are your salary requirements?” You say, “Well, it’s really too early to talk about salary. I just really want to make sure that we’re a great fit for each other. If we’re a great fit for each other, we can work something out. If we’re not a great fit for each other, it doesn’t matter. We shouldn’t work together no matter what the numbers are.” Whatever you need to say, just do not answer the salary question until you’re actually negotiating.

After the negotiation part, they’re going to say, “Okay, we want you to work here,” which is great. You’ve crossed the biggest hurdle. “Now what’s the number?” Most developers will do something like say, “Okay, I hope to get $100,000.” That might or not be a realistic number in your neck of the woods, but let’s say their number is $100,000. That’s unfortunate that the developer just through out a number there, because they’re never going to get more than about 105,000 to 110,000 as a result of that negotiation now, no matter what the company’s actual hiring scale is. Instead ideally the developer came in with an idea from their peers of that company what the company’s scale looks like. If you don’t know anybody at the company, you’re connected to the Internet. You can find people’s Twitter accounts. You can find their email addresses. You can find their information on LinkedIn.

It is well worth your time to take another developer out for a hamburger and say, “Hey, tell me a little bit about the company. Do you guys pay …” Don’t go directly to salary questions, but ask about the working environment, ask whether they like it or not, and then at one point in the conversation ask a fellow peer line engineer, like yourself, “Hey, salaries over there, what’s the range look like?” Surprisingly often people just flat out tell you that, which is now information that you can use in the interview.

When they ask you the salary, you turn the question back on them and say… There’s a variety of ways to dodge it, but one dodge I like is, “You do this conversation with lots of people. You have a great idea of what each engineer is worth to the company. This is the first time I’ve ever had a conversation with you. I’m not in a great position to tell you what my value is to you. You tell me. What number do you think is fair?” Then they name a number. Then you say, “That number is interesting.” Now that number is now your floor for the negotiation. Absolutely nothing you say from this point on means that you get a result lower than that number. You can only go higher. Then you start going higher by asking for more of whatever it is that you must.

Money, in most cases, you can always ask for more money, and then turn that into an ask for something you actually care about, but money’s the primary thing that they’re keeping in their head for this conversation. For example, if they say, “For someone in your position, we feel like the approximate range is 110 to 125.” Then you say, “125,000 is a very interesting number. I think we’re very close. I’m very interested in working with you. Could you do maybe 135,000?” Then the negotiation processes kicks in in full, but eventually where that negotiation is going to settle is probably something in the 130,000 range, and then maybe some slight concessions on other things in the offer, like you get a little more vacation, if you’re smart about it and can negotiate that.

Notice how much better that is for your life than just throwing out the number, “How much money do I need? 100 would be great.” The company really doesn’t care whether they pay you 100 or 130. I know that sounds like a crazy thing, but as someone who runs a business, let me tell you. Businesses have more money flowing around in them than any developer can … The normal human brain is not calibrated to understand the amount of money that flows through a business that’s operating at that size. The difference between 100,000 and 130,000 is ultimately not that big for a business. It’s basis points on a [inaudible 00:52:58] after two weeks. The difference between 100,000 and 130,000 for an actual human though is pretty huge. That could be the difference of whether you’re able to afford a house, for example. Given that the company perceives very little difference between the two, and you perceive quite a lot of difference between the two, negotiate aggressively. Negotiate like a confident, restrained professional who understands that they are worth whatever number that you can successfully extract out of the company.

By the way, it feels like it’s a conversation between two people, because it’s just you and the hiring manager in there talking about the salary, or you and the HR director, whoever your counterparty is. Ultimately, the money isn’t coming out of their pocket. It’s just coming out of a budget somewhere. There’s a cell on a spreadsheet in a spreadsheet that has 68 other cells in that column. The cell is going to be different by a little bit by the standards of the spreadsheet. Just work hard at getting that cell to be the highest number you possibly can.

Where to learn more on this subject

I’ve written a blog post a few times about developer sort of career design and things. One post is called Don’t call yourself a programmer and other career advice for engineers. Another is called Salary Negotiation for Engineers. I’m the top of the Google search results for that. That’s me. In terms of people who write very interesting stuff about careers generally are Ramit Sethi, who’s at www.iwillteachyoutoberich.com, consistently gives some of the best career advice I’ve seen, particularly for people who are younger and very highly driven. He also has some paid courses available, but the free blog posts are pretty good on that, too. He’s been interviewed on my blog a few times. We’ll link up the posts in the description. Another gentleman wrote a book on salary negotiation, which I read recently. There are the likes of maybe Josh Doody [Fearless Salary Negotiation].

Then there exists lots of stuff written on this subject. Unfortunately I feel like — not that our industry and our time is completely unique — but many people who are, say, in another industry or another generation have a very different set of cultural expectations with regards to work, to careers, to the nature of a career path, which makes their advice, perhaps, not maximally relative to us.

For example, my parents, I love them very much, they have always suggested to me that I get into a nice, safe job at a big mega corp, and stay there for my entire career receiving regular promotions every three years, which I’m at the early end of the millennial generation. Man, I hate that word. Whatever. It exists, I guess I have to deal with it. The nature of careers for us is just working for 40 years for IBM and then receiving a gold watch  is something that very few of us are going to be able to successfully do, and that frankly, I’m not even sure I want. Actually, I much more than not sure I want. I’m sure I do not want, do not want, do not want.

I think for the average developer, you’re probably going to be going through quite a few jobs in a relatively compressed period. I would expect your first job as a developer to likely last on the order of two to three years. Then you’re going to do several stints of roughly two to three years prior to really understanding what you know, and focusing in on a particular problem or a particular tech stack, or what have you. You could even potentially go through many more jobs, if you happen to do something like working in start-ups where they get shot out from under you every 18 months. Reading advice that’s written for people whose schema of a successful career is attaching themselves to a large organization and growing with the organization is probably not maximally in your best interests.

What will you be talking about at SIGNAL? 

I’m going to primarily be talking about the ins and outs of doing job searches for engineers. Very similar to the topic we’ve been talking about here, but more about the nuts and bolts details of:

  • how one connects a search for positions which are open
  • how to present yourself to an engineering manager
  • how to know whether you’re a good fit for a position prior to investing a lot of time into applying for it
  • how to conduct yourself in a negotiation
  • how to use the fact that you have multiple offers on the table to optimize for what you care to get with a particular negotiation.

If you’d like to meet Patrick at SIGNAL, register here and use the promocode PATIO11 for 20% ($100) off! 


Patrick McKenzie on the Ins and Outs of Job Searching for Engineers

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

There’s more to chat than sending messages back and forth. There’s chat history, typing indicators, read receipts and integrating with third party software. On top of all that, there’s making sure it all works across both web and mobile devices.

Twilio IP Messaging is a set of APIs and SDKs that provide everything you need to build cross-platform messaging. In this tutorial we’ll get started with IP Messaging by adding simple chat to a Rails app in five steps:

  1. Authenticate a User In Rails
  2. Set up Twilio account credentials
  3. Create a token for the client
  4. Add chat controls to the Rails view
  5. Wire up the IP Messaging with the JavaScript SDK

Assuming you have some familiarity with Rails and JavaScript, this tutorial will take about 20 minutes to complete. To get started, sign up for a free Twilio account.


1. Authenticate a User in Rails

Though there are some use-cases for anonymous chat, typically you want to know who you’re talking to with a reasonable degree of certainty. For that reason, we’ll start with a pre-built Rails app that requires a user to create an account and sign in. There are a lot of great tutorials on Rails authentication out there, so we’ll move through this step quickly.

To get started, clone the starter app and run through the standard procedure to get a Rails app up and running (you’ll need PostgreSQL for this to work. On OSX, I like Postgres App):

git clone https://github.com/GregBaugues/rails-twilio-ip-messaging
cd rails-twilio-ip-messaging
bundle install
rake db:create
rake db:migrate
rails s

Once your Rails is running, visit localhost:3000 and create an account. Then watch this one-minute video that walks you through the app and the code that powers it:

To recap, the key pieces are:

  • session[:user_id]
      tracks if a user is signed in
  • users_controller
    sessions_controller set session[:user_id]
  • authenticate!
      in the
      redirects to the sign-in screen if
  • current_user
      in the
     returns the the signed in user.

2. Setup our Twilio Account Credentials

Add two gems to your


gem 'twilio-ruby' # for interacting with twilio
gem 'envyable' # for managing environment variables

Install your gems:

bundle install

Create a file named

 and paste in these four lines as placeholders for the credentials need to authenticate with Twilio:

ACCOUNT_SID: xxxxxxxxxx
API_KEY_SID: xxxxxxxx
API_KEY_SECRET: xxxxxxxx

Here’s where you find each of those values:

Account SID

Go to your IP Messaging dashboard. In the top right hand corner, click Show API Credentials. Copy your Account SID and add it to the first line of

. (You will not use the Auth Token. More on that below.)


IPM Service SID

Each Twilio IP Messaging app has its own channels, conversations, message history and participants. You’ll need an IPM Service SID to identify which IP Messaging app you’d like to use.

On the IP Messaging dashboard, click Manage Your IP Messaging Service Instances, create a new IPM Service, then copy its Service ID to



API Keys

If you’ve worked with Twilio before, you may be used to copying the

  along with the
. The problem with a single authentication token is that if it gets compromised (e.g. you accidentally commit it to a public repo) then you have to change it in all of your Twilio apps. Instead, we’ll create a set of API keys for use by this app only.

Visit your API keys dashboard, create a set of API Keys and copy their values to




Restart Rails for the values in

 values to take effect.

We’ll use the credentials to create a secure token to pass to the client. Why do you need a secure token? Well, let me tell you….

3. Create a token for the client

Imagine an exclusive club that only allows entrance to members and friends of members. Members show a membership card and whisper a password to the doorman to get in. But what if they want to send a friend to the club in their absence? It’d be unwise to simply give that friend their card and password. Instead, the club gives members tokens that they can then give to friends for one-time access.

Client authentication happens in much the same way. Since client side data can be seen by anyone who knows how to open a JavaScript console, we don’t want to pass our Twilio credentials directly to the browser (do you really want to give The Internet access to your Twilio account?) Instead, we’ll create a temporary access token and pass that to the client. The client then passes it to Twilio to make an authenticated API call.

Add a route in


post 'tokens' => "tokens#create"

In the console, create a tokens controller:

rails g controller tokens


 we need:

  •  The
    before_filter authenticate!
      we saw in Step 1
  • a method to get a token from Twilio. This uses the Ruby gem, our account credentials, a timeout, and the users’s name.

Replace everything in


class TokensController < ApplicationController
  before_filter :authenticate! 

  def get_token

Now, we don’t want to give that token carte blanche access. We need to be specific about:

  • Which user gets access and what device are they on? This combination of user + device is called an “endpoint.”
  • Which IP Messaging service is this token for?

Add a method to create a “grant” to define the endpoint and IP Messaging SID. Endpoints can’t have spaces in them, so we’ll replace any spaces in the username with underscores.

def get_grant 
  grant = Twilio::Util::AccessToken::IpMessagingGrant.new 
  grant.endpoint_id = "Chatty:#{current_user.name.gsub(" ", "_")}:browser"
  grant.service_sid = ENV['IPM_SERVICE_SID']


 route we created in
  expects a
  action. This action will:

  • create a token
  • create a grant
  • add the grant to the token
  • return the token as a JSON Web Token (JWT)

def create
  token = get_token
  grant = get_grant
  render json: {username: current_user.name, token: token.to_jwt}

Visit localhost:3000 again and sign in. Open the JavaScript console and paste:

$.post('/tokens', function(token) { console.log(token) })

Copy the returned token into into jwt.io and you should see something like this:


Now that our client can securely communicate with Twilio, we can add the chat functionality.

4. Add chat to the Rails view

We need to add two UI elements to our accounts view:

  • a box for the chat messages
  • an input field to type new messages

Replace all the code in 


<h3>Welcome <%= @user.email %> </h3>

<h4><%= link_to 'Sign out', sign_out_path %></h4>

<div class="row">
 <div class="col-md-8">
   <div id="messages"></div>
   <input id="chat-input" class="form-control" type="text" placeholder="say anything" autofocus/>

Add this CSS to

 to make the messages box scroll:

#messages {height: 300px; overflow: scroll; border: 1px solid #ddd}

Refresh your account page to make sure your messages box and input field are there.

Below the last JavaScript include in

, include the Twilio IP Messaging JavaScript SDK, and a yet to be created

<%= javascript_include_tag '//media.twiliocdn.com/sdk/rtc/js/ip-messaging/v0.8/twilio-ip-messaging.min.js' %> 
<%= javascript_include_tag 'chat.js' %>

For the sake of avoiding an asset pipeline tangent in an already long tutorial:

  • create the directory
  • create a file called
      in there. 
  • In
     , add this function to print to the messages box

function printMessage(message) {
  $('#messages').append(message + "<br>");

Reload localhost:3000/account. Open the JavaScript console and type

printMessage("Hello Chat!")
 . If a message shows up in the messages box, you’re good to go.

5. Wire up the IP Messaging

Last step! We’ll use the Twilio IP Messaging JavaScript SDK to:

  • join or create a chat channel
  • send and receive messages in that channel

Now, my apologies for the big blocks of code that’s about to follow. I tried breaking it up several times, but JavaScript’s indentations and punctuation made it much easier just to throw it down in one chunk.

Below the

  function in
 , add a jQuery ready function where the rest of the code in this tutorial will live. Here we create variables for a channel and username. Then we create a setupChannel() function that:

  • define variables for the channel and username
  • join the channel and then print a message saying that the use has joined the channel
  • bind an action to the
     event (which comes from the Twilio SDK) to print the message to the screen

Then we will listen to the

  field for a keyCode of
  — that’s the enter key. When our bound function hears that, we’ll send the value of that field to the channel as a message.

Here’s the code:

$(function() {
    var chatChannel;
    var username;

    function setupChannel() {
        chatChannel.join().then(function(channel) {
            printMessage(username + ' joined the chat.');

        chatChannel.on('messageAdded', function(message) {
            printMessage(message.author + ": " + message.body);

    var $input = $('#chat-input'); 
    $input.on('keydown', function(e) {
        if (e.keyCode == 13) {


If it feels like something is missing from that

 function, you’re right. We need to get our channel from the Twilio IP Messaging SDK. To do that we:

  • use an async JSON request to retrieve a token from our token server
  • use the token to create an
      and a

With that

  we can:

  • look up the the
  • If the channel exists, store it in our
     variable and run a yet to be created function called
  • If it doesn’t exist, create the channel before doing those two things.

Inside the

 , below that last bit of code you pasted to listen to the keypress, paste this block:

$.post("/tokens", function(data) {
    username = data.username;
    var accessManager = new Twilio.AccessManager(data.token);
    var messagingClient = new Twilio.IPMessaging.Client(accessManager);

    messagingClient.getChannelByUniqueName('chat').then(function(channel) {
        if (channel) {
            chatChannel = channel;
        } else {
                uniqueName: 'chat',
                friendlyName: 'Chat Channel' })
            .then(function(channel) {
                chatChannel = channel;

Open up two browsers (probably need an Incognito mode) and chat on with your bad self!



We’ve just scratched the surface of what’s possible with IP Messaging. In fact, the full power of Twilio IP Messaging is that in addition to offering a way to pass real-time messages, it also gives you chat history,  typing indicators, read receipts and REST APIs to integrate with 3rd party solutions. There are also SDKs for Android and iOS apps.

To learn more, check out the Twilio IP Messaging API Documentation.

If you have any questions or build anything cool with IP Messaging, I’d love to hear about it. Hit me up at gb@twilio.com or on Twitter at @greggyb.

Add Chat to a Rails App with Twilio IP Messaging

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

February 02, 2016

Over the past couple months, Twilio has been testing additional safeguards and checks around SSL certificate validation. During the week of October 12th 2015, we deployed a change to our HTTP proxies to validate SSL certificates. This feature is enabled by default for all new accounts. We have deployed a change to our Account Portal so developers can choose to enable this validation.

What is the purpose of this safeguard?

The purpose of the certificate validation process is to prevent Man-in-the-Middle attacks on HTTPS connections.

How does this safeguard impact me?

This change impacts customers who use HTTPS endpoints to receive requests from Twilio. If certificate validation is enabled and you are using a self-signed, expired, mis-matched domain or a certificate not issued by a trusted-certificate authority*, HTTP requests to your application from Twilio will fail, which will result in a error notification. Error notifications are available in Monitor under Alerts.

*Twilio considers any Certificate Authority included in the Mozilla Trust Store and Java CA Store to be trusted.

How do I enable this safeguard?

This setting is enabled by default for all new Twilio accounts created after October 2015. We strongly recommend you maintain a valid certificate and enable certificate validation for all production applications.

You can enable or disable this safeguard within the “Account Settings” page under “SSL Certificate Validation.”SSLCertificate

To help you debug failures related to certificate validation, we created three new error codes which will be thrown when certificate validation causes an HTTP request to fail.
11235: Certificate Invalid – Domain Mismatch

11236: Certificate Invalid – Certificate Expired

11237: Certificate Invalid – Could not find path to certificate
You can read more about these errors by following the links above to the error reference page or by by selecting “Alerts” under the Monitor product.

What additional resources are available?

You can validate that your endpoint is presenting a valid SSL certificate by pointing this tool from SSL labs at the endpoints you use to communicate with Twilio: https://www.ssllabs.com/ssltest/
As always, you can reach our Support Team at: help@twilio.com

Security Update On SSL Certificate Validation

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google


At this point, customer surveys are a given for most businesses. Using surveys gives you deeper insight into customers’ opinions, and helps you predict how likely they are to continue using your services. In other words, surveys help you maintain the best parts of your customers’ experiences, and prevent repeating any mistakes, all while giving you a personal look at the different preferences within your target audience. There are three commonly accepted methodologies to collect customer satisfaction, and the importance of each has evolved over time.

  • Customer Satisfaction Score

    As its name suggests, the customer satisfaction score (CSAT) is a percentage that reflects how satisfied a customer is with a company’s service. It’s a sliding scale, with 0% reflecting no satisfaction, and 100% reflecting complete satisfaction. The metric is usually collected through questions that ask customers to rank their satisfaction on a scale of one to five across a number of dimensions. CSAT scores have been widely accepted as a performance indicator, and industry scores are aggregated by the American Customer Satisfaction Index.  While CSAT scores give insight into how customers feel about your company, they are short-term measures that fail to predict long-term loyalty.

  • Net Promoter Score

    The Net Promoter Score (NPS), on the other hand, sorts customers into three categories: detractors, passives, and promoters. The NPS metric is based on responses to questions such as “How likely are you to recommend us to someone you know?” The percentage of detractors, those likely to look elsewhere for the product, is then subtracted from the percentage of promoters, who are likely to enthusiastically recommend you to others. The difference between the two percentages is the Net Promoter Score. Compared to the earlier CSAT, the NPS score is a better predictor of future customer behavior, especially if you follow up with an inquiry about the most important reason for their score.

  • Customer Effort Score

    The most recent trend in customer satisfaction research is the Customer Effort Score (CES). The CES measures how much effort a customer invests in an exchange with your company. While there are multiple ways to phrase a CES survey question, they generally ask customers how much they agree or disagree with the statement, “The organization made it easy to handle my issue.” The higher the number, the less effort it takes for a customer to work with your company. Generally, companies who ace the NPS score also have high marks in the CES, reflecting that customers like companies who make customer service as easy as possible. However, just because a customer is willing to promote your product, doesn’t mean that they had an effortless experience. In fact, studies have shown that CES is two times better than the NPS at predicting customer loyalty.

Over time, surveys have evolved from valuing vague measures of satisfaction, to the proportion of customers who would endorse a product, and finally to a measure of customer effort in receiving service. However, the goal of the feedback has remained consistent: to determine reactions to the present service and predict future customer behavior.










Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Granted, it’s not as vitally necessary as a technology that would keep me from overhearing every phone conversation on the bus and subway during my commute every morning and again in the evening, but this ranks very high on the list. It might ensure that the person on line behind you at the CVS pharmacy counter doesn’t […]

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

By Nabil Eid, guest blogger. 

Nabil Eid is an ICT Accessibility consultant in the Middle East, as well as a Middle East Specialist at Telecentre Foundation. Telecentre Foundation (TCF) is an international organization as well as a global network of people and organizations that believe information, communication technologies (ICT) and the Internet have the power to nurture local talent, empower communities and create new opportunities for all. Contact Nabil at neid@telecentre.org or follow him on Twitter @nabileid1.

The research study investigates a model of delivering assistive technology training, ICTs and IT skills to women with disabilities with a variety of disabilities who are enrolled in telecentres, knowledge centers, ICT access point centers and others.

Information and Communication Technology (ICT) can be used in the most effective ways for education and training of (young) women with disabilities in the Middle East. The digital literacy needs of women with disabilities are extremely diverse. As with all other members of society, young women with disabilities must acquire the knowledge and skills required for the community in which they live.
The application of ICT is very important as it plays an essential role in supporting high quality education for women with disabilities learners. The advantages of ICT usage in the teaching and learning process are based on the possibilities it offers for alternative means of communication, providing access to educational resources in a more convenient way and to enhancing learning motivation.
Women with disabilities are more likely to face poverty, unemployment and under-education than their male counterparts. This means they are less likely to have access to ICT, which, in turn, means they are less likely to overcome socioeconomic barriers.
ICT & Assistive Technology (AT) are offering new opportunities for everyone, specifically for women with disabilities. They can use ICT and AT for daily activities to a higher extent than people in general. Assistive technology adapted to the abilities of everyone, disabled end-users would be able to participate to all aspects of social life on more equal terms than ever before. It is vital for girl’s’ students with disabilities to benefit, on an equal basis, from rapid development of Information Communication Technologies to enter an inclusive and barrier-free Information Society.
Today with the advent of (ICTs), new hopes are emerging for Persons with Disabilities (PwDs). In spite of the huge challenges, sincere efforts are being undertaken to involve ICTs to counter issues around disability. The information society represents at once significant opportunities but also potential new barriers for the social inclusion of disabled people.

“A journey of a thousand miles begins with a single step.”

We need information and knowledge to get our basic needs met, make decision, move around, participate in social, economic and cultural activities. ICT is of course an enabling technology and we should not lose sight of this fact. If it is not properly planned, managed and implemented, it might throw us into social gaps or the ‘digital divide’. The use (ICTs) in the field of learning and education is very high on the political agendas of countries and we are required a lots of efforts at national, regional and global level to address the special requirements of women with disabilities, using appropriate educational, administrative and legislative measures to ensure their full inclusion.
ICT&AT for development of female students with disabilities is adopting feasible techniques to attain the maximum benefit in addition the use of Assistive Technology (AT) can increase their capabilities and independence in both in and out of school settings. The items can be used for communication and productive or to provide an individual with an opportunity to experience recreational opportunities.
Individuals with serious sensory disabilities such as physical disabilities, visual impairments or deafness have benefited more than any other group of individuals from advances in assistive technologies. The advances in technology for these individuals can lead to increased productivity, employment and recreation opportunities.
Some progress towards disability inclusive development; there have been very few initiatives aimed to include disability in the Sustainable Development Goals (SDGs) “Education for All.”

ICT Providing Computer Accessibility for Women with Disabilities

For intensive exchanges of knowledge and experience in promoting awareness, planning and developing accessible ICTs solutions in the context of sustainable and equitable development for present and future generations. To address the digital divide faced by women with disabilities in the world and to promote the digital opportunities of Women with Disabilities, the decisions and declarations adopted a set of recommendations including the definitions of Women with Disabilities, (ICT) “and “Accessibility”. “Accessibility” can readily be reached or used by Women with Physical Disabilities, Blind and Visual Impairments, Intellectual and Hearing Disabilities. Also, Learning Disabilities, Autistic Spectrum Disorders, Down Syndrome and Dyslexia.  The role of ICT is promoted to enhance teaching, learning and explore the following issues relating to how ICT enhances learning, and it will also explore how ICT enriches the learning opportunities and potential of women who have disabilities. It is largely a software concern; when software, hardware, or a combination of hardware and software, is used to enable use of a computer by a woman with a disability.

Use ICTs & AT in digital literacy to achieve more:

  • ICT can help females with disabilities to provide access to learning.
  • ICT can provide support for learning.
  • ICT can help females with disabilities teachers and promote their skills.
  • ICT help female students to merge in their local society.

The People are the real wealth of nation

ICT is providing opportunities and making life easier for the women with disabilities by innovations in quick successions. Women with disabilities are now able to communicate with each other and learn through tools of Assistive Technology (AT) and Information and Communication Technologies (ICTs).  Despite the fact that AT&ICT are helping females with disabilities to learn and interact, there are some barriers that come in the way of the disabled to take advantage of the wonderful technologies. People with disabilities should have the same rights to participate in the Information Society as other citizens. ICT accessibility should be tools that help overcome barriers they face in education, the workplace and social life.

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

February 01, 2016

JavaScript has been my go-to language for quite some time now and before that it was Ruby. Both of these languages have a lovely dash of functional programming that I’ve toyed with here and there. It seems functional concepts are becoming more and more prominent amongst the JS community with projects like Redux and Immutable.js gaining popularity. I recently decided to take the dive into functional programming. A friend recommended the Clojure programming language and learning it has been a real hoot.

Clojure was created by Rich Hickey who had a very strong rationale for its birth. The language is designed to compile down to bytecode and run on a virtual machine so it’s not OS dependent. The JVM is the the most popular target but it can also compile down to JavaScript or the Microsoft CLR. Thanks to strong interoperation support you can easily take advantage of your target platform’s host language and features. We’ll see an example of this later on.

In this post we’re going to start with the basics of Clojure and its de facto build tool Leiningen. We’ll wrap up by sending our first SMS with Clojure.

I’m absolutely still an apprentice so feel free to help out below in the comments if something can be improved. I’ve found that the Clojure community is super friendly and willing to help. Heck the language is community developed.

Time To Get Technical

Let’s start by installing Leiningen. Not only does it have the best mascot logo but might just be the best build tool I’ve ever used.

The Clojure compiler is actually just a JAR file and Leiningen will take care of downloading it and doing all the heavy javac flag and classpath lifting.

Follow the instructions based on your platform. There is also an installer for Windows and a Homebrew formula if you’re on a Mac.

We can confirm it’s installed by running the following.

lein repl

This will start up a Clojure Read Eval Print Loop (REPL) and give you a nice little prompt.

Clojure is a lisp which means it uses tons of parenthesis and prefix notation. Calls to functions start with the name of the function and then the arguments. So to use the + function to add 2 + 2 we can type the following into our REPL.

(+ 2 2)
; 4

This construct is called a form and the “words” inside of it are known as symbols. We can easily chain forms by adding more parenthesis.

(+ 2 (+ 2 2))
; 6

Notice we don’t need to use commas to separate symbols – they are optional and treated as whitespace. The syntax will take some getting used to but I’ve found it to be very expressive.

The native data structures are powerful and are used everywhere. The most common we’ll be using are the vector and the map.

The vector is what we might think of as an array. It is a list of elements enclosed in square brackets. [1 2 3 "a" "b" "c"]. We can generally ask for the first item out or the rest to perform a recursive operation on the vector.

(first [1 2 3])
; 1

(rest [1 2 3])
; (2 3)

We can also access an element at an index using the get function.

(get ["Cats" "Dogs" "Fish"] 1)
; Dogs

Let’s iterate over a vector and call a function on each element using doseq. This function expects a symbol and a collection that it will iterate over and bind to the symbol. It then calls your provided form for each item. We’re also using the println function which, as you guessed, prints a line to the console along with the str function which concatenates strings.

(doseq [name ["Betty" "Sue" "Amy"]]
  (println (str "Hello, " name)))
; Hello, Betty
; Hello, Sue
; Hello, Amy
; nil

The map is our dictionary structure in Clojure. It’s created with curly braces and a set of keys and values separated by whitespace. This one’s a little tricky to get used to since we’re not visually associating the key and the value.

(get {"name" "Bob Barker" "game" "The Price is Right"} "name")
; "Bob Barker"

It’s common to use Clojure keywords as the key for a map. A keyword is a symbolic identifier that evaluates to itself. We denote a keyword with a colon.

(get {:name "Bob Barker" :game "The Price is Right"} :game)
; The Price is Right

Since this is so common we can actually use the keyword as a function and pass it a map to pull out the value.

(:name {:name "Bob Barker" :game "The Price is Right"})
; Bob Barker

The last building block we’ll learn is how to define our own function. To do this we use the defn macro. The form of this is (defn name-of-function [args] (body)). The following function say-hello will take a name and print out a personalized greeting.

(defn say-hello
  (println (str "Hello, " name)))

(say-hello "Mary Poppins")
; Hello, Mary Poppins
; nil

Our function can take an undefined number of arguments using the & operator. This causes all the arguments passed in to be squished into one variable as a collection.

(defn say-hello
  [& people]
  (doseq [person people] (println (str "Hello, " person))))

(say-hello "Albert Einstein" "Grace Hopper" "Ada Lovelace")
; Hello, Albert Einstein
; Hello, Grace Hopper
; Hello, Ada Lovelace
; nil

Finally let’s have a go at the Java interoperation that’s available. We’ll use Java’s Date class to get the current time. To do this in Java you’d run the following.

System.out.println(new java.util.Date());

In Clojure we pass the full path and package name to the new function.

(new java.util.Date)
; #inst "2015-11-09T22:29:37.530-00:00"

This is done so much that there is a nice shortcut around it. Note the trailing ..

; #inst "2015-11-09T22:29:37.530-00:00"

We can call methods on the returned object with the .methodToCall function.

(.toString (java.util.Date.))
; Mon Nov 09 18:18:24 EST 2015

; This syntax comes from the base `.` function

(. (java.util.Date.) toString)
; Mon Nov 09 18:18:55 EST 2015

Even better, if we want to chain a bunch of Java method calls the .. function makes this easy.

(.. (java.util.Date.) toString toUpperCase)
; MON NOV 09 18:19:06 EST 2015

Hello, World!

We now have enough of a basis to create our first Clojure app. We’ll leave the REPL and use Leiningen to generate our skeleton. The quit command should take you out of the REPL.

Create a new directory where you want to work and cd to it in your shell. Now let’s unleash Leiningen on our new directory and have it create a blank app project for us.

lein new app hello-clojure
cd hello-clojure

There are two files in here that we’ll be working with. The first is project.clj which is our build file for Leiningen and the second is our source file at src/hello_clojure/core.clj. We’ll come back to the build file in a bit but for now let’s open up the source file in your favorite editor.

The top two lines set up our namespace and tell the compiler to generate a class for our app since Java uses classes and we’re running on the JVM. Following that is our main function definition which is the entry point to our app. The string after the declaration is used to document what this function does. The rest should look familiar from above.

(ns hello-clojure.core

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (println "Hello, World!"))

We can tell Leiningen to compile and run our application by running

lein run
# Hello, World

Even better we can painlessly build an uberjar that we can distribute and run on a standard JVM.

lein uberjar
# Compiling hello-clojure.core
# Created /Users/ezaneski/Codez/hello-clojure/target/uberjar uberjar/hello-clojure-0.1.0-SNAPSHOT.jar
# Created /Users/ezaneski/Codez/hello-clojure/target/uberjar/hello-clojure-0.1.0-SNAPSHOT-standalone.jar
java -jar target/uberjar/hello-clojure-0.1.0-SNAPSHOT-standalone.jar
# Hello, World

Wow that was absurdly easy.

Sending an SMS

Our program is rad but doesn’t do much. Let’s fix that by making it send a text message. You’ll need your Twilio account credentials and a Twilio phone number. If you don’t have an account yet you can sign up for a free one here.

An awesome community member has created a Twilio Clojure library that makes sending an SMS a breeze. To add the dependency to our app open up project.clj And add [twilio-api "1.0.1"] to the :dependencies vector.

(defproject hello-clojure "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [twilio-api "1.0.1"]]
  :main ^:skip-aot hello-clojure.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

We can have Leiningen download the dependency by running the following.

lein deps

Open up core.clj again and replace it with the following. You’ll notice a that we’re using an @ in front of the call to twilio/send-sms. It’s a bit out of the scope of this post but that’s actually a shortcut for the deref function which causes our program to block and wait for an asynchronous operation to complete – such as the HTTP request to Twilio’s API. If we don’t block on the HTTP request, the program will stop running before it’s made due to it being asynchronous.

(ns hello-clojure.core
  (:require [twilio.core :as twilio])

(defn -main
  [& args]
        :Body "Hello from Clojure!"})))

Run the code one last time and take out your phone.

lein run


Next Steps

We’ve explored some of the basics of Clojure and seen how we can take advantage of the Java interop. We also wrote a function that sends an SMS using an stellar community created library. I think we can all agree that Leiningen lives up to its tagline of “… automating Clojure projects without setting your hair on fire”.

Hopefully this post has inspired you to give Clojure a try. It is a much different paradigm but pretty fun to work with.

For more reading and learning check out the book Clojure for the Brave and True by Daniel Higginbotham. And the Clojure from the ground up blog post series by Kyle Kingsbury.

Be sure to let me know what your thoughts on the language are!

Twitter: @eddiezane

Getting Started with Clojure

Bookmark this post:
Ma.gnolia DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google

Last updated: February 10, 2016 07:01 PM All times are UTC.
Powered by: Planet

Speech Connection and Logos are Trademark of Nu Echo Inc. Copyright 2006-2008.