How to Text with Hodor
Time to read: 2 minutes
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.
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:
- Write the three lines of code to respond to a text message
- Write the three lines of code to respond to a phone call
- 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.
- Go to your Twilio Console.
- Scroll down and click Developer Center.
- Click TwiML Bins.
- Click Create a New TwiML Bin.
- 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:
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.
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.
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:
Forward the call to you cellphone, giving you a temporary phone number:
Create a conference line:
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.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.