How to Text with Hodor

June 23, 2016
Written by

hodor-call-center

Hodor is not man of many words. In fact, he’s just got one: “Hodor.” And while communication may not be his forte, one wonders how his adventures with Brandon Stark might have turned out if they had the mobile communication technology we all take for granted today.

Thanks to the recent release of TwiML Bins we don’t have to wonder any longer. To get in contact with Hodor, you need only call or text our Hodor Hotline at (917) 722-6264. Ask him anything you like, and digest the wisdom of his reply.

text-hodor

Even if you’ve never written a line of code before, you can build a hotline like this yourself in just five minutes with TwiML Bins. It’s easier than falling out the moon door. You’ll need to sign up for a free Twilio account to get started. Then there’s just three steps: 

  1. Write the three lines of code to respond to a text message
  2. Write the three lines of code to respond to a phone call
  3. Buy a Twilio programmable phone number

Write the Code

TwiML is a simple set of instructions used to program your Twilio number. TwiML Bins let you host static TwiML without setting up a server of your own. We’ll create two TwiML Bins – one for the instructions on what to do when a text message comes in, and one for phone calls.

  1. Go to your Twilio Console.
  2. Scroll down and click Developer Center.
  3. Click TwiML Bins.
  4. Click Create a New TwiML Bin.
  5. Name your TwiML Bin “Hodor SMS”.

Valid TwiML starts with a  <Response> tag, ends with a  </Response> tag, and has instructions in-between. Here we’ll use the <Message>  tag to reply to an incoming message. Paste the following code to respond to an incoming text message, then save your TwiML Bin:

<Response>
  <Message>Hodor.</Message>
</Response>

Now create a second TwiML Bin and name it “Hodor Voice.” Here we’ll <Play> a WAV file that’s hosted on Dropbox (of course, you can swap in the URL of any publicly accessible MP3 or WAV if you’d like). Paste this code in, then save your TwiML Bin. 

<Response>
  <Play>https://www.dropbox.com/s/dn5as27x5anez0t/hodor.wav?dl=1</Play>
</Response>

 

hodor-twiml-bin

Buy your programmable phone number

Congrats! You just wrote some TwiML. Now you just need a phone number.

  • Go to your Twilio Phone Numbers.
  • Click Buy a Phone Number.
  • Search for a number that suits you. 
  • Click Buy

Confirm your purchase and click Setup Number. Now we need to tell Twilio where to find instructions on what to do when someone calls or texts this number. 

  • Under Voice, look for the line that says “A call comes in.” Change the first box to “TwiML” and the second to “Hodor Voice”.
  • Under Messaging, look for the line that says “A message comes in.” Change the first box to TwiML and the second to “Hodor SMS.”

Ensure your settings look like this, then hit Save.

hodor-phone-number

 

That’s it! Text your shiny new Twilio phone number. Then, give it a call.

What’s Next?

There’s so much more you can do with TwiML Bins and a programmable phone number. For instance, go back to your “Hodor Voice” TwiML bin and replaced the  <Play></Play> line with these variations: 

Talk in a robot voice:

<Say loop="10">Hodor</Say>

Forward the call to you cellphone, giving you a temporary phone number: 

<Dial>1-312-XXX-XXXX</Dial>

Create a conference line:

<Dial>
  <Conference>My Conference Line</Conference>
</Dial>

To learn more, check out: 

If you build something cool with TwiML Bins, hit us up at @twilio. And if you have any questions, drop me a line at @greggyb or gb@twilio.com