TL;DR: Twilio’s API lets you make calls, send texts or send multi-media messages en masse. By connecting to the API, you can add appointment reminders, two-factor verification or ETA alerts to your app.
We recently added the Twilio API package to our website and we’ve got to admit, it’s pretty cool. This is the same API allows Uber to text users an ETA, AirBnb to confirm reservations over text, and Box to secure accounts with two-factor verification.
How to Connect to the Twilio API
Connecting to the Twilio API isn’t too painful. Here’s what you have to do.
1. Get the Twilio Credentials
First things first, you’ll have to get Twilio credentials to access its API.
1a. Create a Twilio Account
Head over to Twilio.com/console to create an account. This step will involve either paying for a Twilio account or signing up for a free trial. We chose to sign up for a free trial. Have your phone handy for the two-step verification process!
1b. Go to “Account Details” to Get API Details
Once you’re logged into the actual Twilio console, go to “Account Details” and retrieve your custom
1c. Get a Twilio Phone Number
Twilio requires you to get a Twilio phone number to make calls or sends messages from. You can get one number for free.
- Go to the Phone Numbers page of the Twilio Developer Console
- Click “Get Started”
- Click “Get your first Twilio phone number”
- Click “Choose this Number”
And there you have it! You can use this number to make a call or send an MMS/SMS through the API.
Note: All phone numbers in Twilio’s API require E.164 formatting. All that means is “+” then country code, then number, with no dashes or spacing. For example, +18675309.
1d. Get a Twilio
If you want to call the
sendMms endpoints, you’ll need a
messagingSID. Here’s how to get one:
- Go to the SMS Services page of the Twilio Developer Console
- Create a New Messaging Service
- Grab your Service SID! This is your
2. Make Calls Using RapidAPI
Next up, we’ll actually connect to the Twilio API to make calls and start coding.
2a. Find Twilio API at RapidAPI.com
Go to RapidAPI.com and search for “Twilio.” The result should take you to the Twilio Package page. Once you’re on the Package page, click on the “Functions” menu item to see the full list of endpoints or click on the function that you would like your app to perform (ex. sendSms).
2b. Use Your Credentials to Make Connection
Once you’re on the Package page, you can use your Twilio API credentials to connect to the Twilio API. Fill in
accountToken and whatever necessary parameters you need from previous steps (ex. a from phone number) to get started.
2c. Login to RapidAPI to Access Code Snippets
In order to see the code on the right side window, you’ll have to create a RapidAPI account. Login with your GitHub, Facebook or Google accounts to make the process as quick as possible.
2d. Customize Fields and Language
Yay, you’re logged in! Now, just fill in the fields with the information that your app requires and the code will display in real-time on the window to the right. Pick NodeJs, PHP, Python, Java (Android), Objective-C (iOS), or cURL to select the code that best fits your project’s needs.
We’d love to hear what kind of projects that you build with the Twilio API! Leave us a note in the comments about your app. If you have any questions, you can ping us directly on the RapidAPI website chat function.