Getting Started with Twilio API

Follow these step-by-step instructions to get the Twilio API keys and a phone number.

To use Twilio products, we need to create a Twilio account.

Create an account

Follow the steps given below to create an account on Twilio:

  1. Visit the Twilio website to sign up for an account and enter your credentials.

  2. Verify your email and phone number.

  3. Complete the initial configuration settings on the Ahoy page.

The slides given below demonstrate how to create an account on Twilio.

Get the API keys

We need an Account SID and Auth Token to use Twilio’s services. These keys can be found on the Twilio dashboard, as shown in the image below:

Fetch Account SID and Auth Token
Fetch Account SID and Auth Token

Save the API keys

Now that we have our API keys, we can access the various endpoints available in Twilio. Before continuing with this course, let’s save and verify our Account SID and Auth token.

Click “Edit” in the code widget below and enter the Account SID and Auth token you copied from Twilio. After that, click “Save” to replace the value of the keys throughout the course. Click “Run” to execute the code.

VerifyKeys();

We’ll get a JSON object if the Account SID and Auth Token are valid. Otherwise, an authentication error is displayed. 

Twilio phone number

We need a Twilio phone number to send and receive messages and phone calls. This phone number can be found in Twilio’s dashboard, as shown in the image below:

Fetch Twilio phone number
Fetch Twilio phone number

Let’s save and verify this number in the widget below. Click “Edit” and enter your Twilio phone number and the number used to create your Twilio account in the following format: “+ [country code] [phone number].”

Click the “Run” button to run the code.

verifyTwilioNumber();

We’ll get a JSON object if the Twilio phone number and your phone number are valid. Otherwise, an error is displayed. 

Now that we have saved and verified our keys and phone numbers, let’s get started!