Twilio is a cloud-based platform as a service that provides voice, SMS, video and WhatsApp communication services. The best part is, it can be easily integrated with ruby using twilio-ruby gem. The scope of this post is limited to setting up a Twilio account with phone numbers.
Basic steps in setting up a Twilio account
Buy a Twilio Number Verify caller IDs Create and link TwiML to phone numbers
Step 1: Buy a Twilio Number
The first thing while setting up the Twilio account is to buy a Twilio number. After signing in to the account go to the console and select phone numbers menu option as shown below
Now, we can search for the phone number of our preference by selecting different options as shown below
Choose a number and buy it
Step 2: Verify caller IDs
Inbound or outbound calls made to or from the phone numbers must be verified numbers for a free trial account. We can add verified phone number either by using REST API ( This is not included in the scope of this post. Please check the Twilio API Documentation for details) or from Twilio console.
Add a verified phone number using the console.
Select the Phone Numbers option.
Select the Verified Caller IDs option. Click on plus sign shown in the following snapshot.
Now, enter the phone number and choose the method for the verification. Phone number can either be verified by a call from Twilio or Text.
Step 3: Create and link TwiML to phone numbers
TwiML (Twilio Markup Language) is a set of instructions used to tell Twilio the actions to be performed when an incoming call, SMS or Fax placed to our Twilio number.
Create a new TwiML
- Select TwiML Bins option from the console.
- Click Create New TwiML Bin button to create new TwiML.
- Write TwiML code here.
- Link TwiML to Twilio Phone Number.
- Select a Twilio Phone number to associate a TwiML.
- Select and Associate a TwiML to a Twilio number.
Setting up a Twilio account to integrate with Rails is straightforward and easy. A free trial account provided by Twilio is a very good facility to learn features like inbound calls, outbound calls, sending SMS & fax, etc. Also, Twilio provides a very user-friendly UI.