Getting Started with Twilio

Getting Started with Twilio

Twilio makes it easy to build apps that communicate with everyone in the world with our APIs and SDKs. Let’s see how it works by getting a free API key. First I’ll punch in my name, company, and an email address as well as choosing a password. Next Twilio will ask me which product I want to try first. Since we’re just playing around for now I will pick “I’m just exploring”. We’re going to take a look at SMS and Voice though. We don’t really have a project in mind so I’m not going to pick a use case from this drop down. If you do have a use case pick it there so that Twilio can help you get started. Next I need to punch in a phone number to verify with Twilio. It’s going to send me an SMS with a verification code. Punch in the 3228 and then the 2 words that appear in the reCAPTCHA and we can get started. This drops us into the Console where there’s a quick tour of functionality. This is showing how to get to the list of products.

We’ll click on that and we can pin some products that we’re going to work with. In this screencast we’ll work with Voice, SMS, and Phone Numbers so I’ll pin those now. This prompt points out the Developer Center which we can use later for debugging and then we’re dropped back into the Console Dashboard. The first thing we’re going to do in this screencast is take a look at Programmable SMS.

Clicking on that we’ll see that there’s a Get Started button that we can use to build our first application. Click to get our first Twilio number. If you like this one you can keep it but there’s also a link here to search for another number. Since I’m in Philadelphia I’ll punch in 215 to look for 215 numbers in my area. I get a list of numbers that I can pick that all have Voice, SMS, and MMS capability. I can also search here for a word so I’ll look for “video” at the end of the number. Searching for that we’ll see a bunch of numbers in a variety of areas that end in “video”. You’ll also see from this dropdown that Twilio supports numbers in a lot of countries. We’ll pick the first number that ends in video. That’s a number in Newton, MA. We’ll choose that number and just like that we have our first Twilio phone number to work with. Now that we have a Twilio phone number, we can use it to send an SMS to our cellphone.

So you’re only going to be able to do this with phone numbers you’ve verified with Twilio but that’ll work against your cellphone that you just verified. We can punch in the Body of the text message that we want to send to our cellphone. I’ll say “Helo from Twilio on YouTube!” and then we can take a look at what the request code looks like. So here’s what it would look like in curl. It’s just a request to to the Messages resource inside of our account. We can see what it looks like in Ruby, PHP, Python, Node, Java, and C# if you’re using one of our helper libraries.

When we make the request it’s going to send a message to my cellphone. When we open it up it says “Hello from Twilio on YouTube!” Next let’s take a look at how inbound Twilio SMS works. So if someone sends a message to your Twilio phone number, Twilio makes an HTTP request to your application and your application returns Twilio some instructions in the form of TwiML, which is Twilio’s Markup Language. Twilio executes those instructions and responds with an outbound SMS. Let’s take a look at what TwiML looks like. So we have a Response tag that has a Message tag that says “Hello from Twilio!” When we run that and send “Hi!” back to our Twilio phone number, we get a response that says “Hello from Twilio. There are some other “Getting Started” guides that you can find in SMS. We have one for Building Appointment Reminders but for now we’re going to jump to Twilio’s Programmable Voice to see how that works.

We’ll click “Get Started” like we did for SMS and we’ll be dropped into another guide that goes step-by-step through the process Since we already have a Twilio phone number we don’t need to create another. We’ll use the one we already have. I’ve modified the response to <Say> “Hello from Twilio on YouTube”. when the call is placed. Let’s see what that sounds like. Phone: You have a trial account. You can remove this message at any time by upgrading to a full account. Press any key to execute your code. Phone: Hello from Twilio on YouTube Awesome, so Twilio was able to make a call to our cellphone.

What happens when we call Twilio? This is going to function very similar to the way SMS did. Call comes into the number, Twilio makes an HTTP request to the application, application responds with TwiML and Twilio executes the instructions with an automated message. In this case we’re going to say “Hello from Twilio! You’re ready to build voice apps.” because we definitely are at this point. So we’ll add that to the TwiML. We’ll click Save and then it’s going to prompt us to make a call from our cellphone so let’s do that. Let’s get the phone out and dial 6-1-7 6-5-8 4-3-3-6 and call Twilio back.

Phone: You have a trial account. You can remove this message at any time by upgrading to a full account. Press any key to execute your code. Phone: Hello from Twilio! You’re ready to build voice apps now. Thanks robot voice for the affirmation. Yes we did receive the call so we’ll click “Yes”. There are a few more getting started guides in here. There’s one for call tracking and there’s one for IVRs but that’s all we’re going to go through in this screencast for Programmable Voice. I did want to point out one more tool in here that you might want to check out next inside fo the Developer Center. That’s the API Explorer where you can make sample requests and see how to do other things in Twilio.

Leave a comment down below to let me know what you want me to build a screencast for next. That’s gonna do it for this video. If you enjoyed this That’s going to do it for this video. We have a lot more videos coming from Twilio. Please click Subscribe so you know when they come out and check out some of these other videos to learn more about how Twilio works. Until next time, I’m outta here. ♪♪♪.

Read More: 7 benefits to adopt an automated response system