Send SMS to your Mobile number using APIs

Use Twilio's Messaging API to send SMS from your command line

Send SMS to your Mobile number using APIs

What is Twilio?

Twilio is an American company based in San Francisco, California, which provides programmable communication tools for making and receiving phone calls, sending and receiving text messages, and performing other communication functions using its web service APIs

51799423-1604887257718891_origin.png

In the earlier blogs, we discussed the basic terminologies and introduction to APIs. Here, we would learn by making our first API call. Sounds exciting!!!

Why Twilio??

  • Beginner friendly
  • Free Trial without Credit Card
  • $15 credit trial
  • Get a trial phone number for use

The objective of this blog --> To send a text message from Twilio Number to Your own phone number using the command line

STEP 1

Click here to Visit Twilio

Create a new account

Verify your email

Get a Twilio phone number by choosing the trial pack

image.png

STEP 2

After you are done with STEP 1, Your Twilio account would look like this

Screenshot 2022-07-16 005709 (1).png

Note- Account SID and Auth token are important and confidential

Click here to Try out the SMS service

You would see -

Screenshot 2022-07-16 010615 (1).png

Fill in your Messaging SID, the Phone number to which you want to send, and the text message.

image.png

You would notice code snippets like this with a variety of programming languages-->

image.png This code is what is required to request data from the server (Calling the API)

Note - Replace the text [AuthToken] with the Auth token of your account

STEP 3

Copy the Python code.

image.png

Note - We are using python code because it is easy to use and understand

STEP 4

Open command prompt and type-->

pip install twilio

This will install the twilio package to be used.

image.png

STEP 4

Open any IDE. In this case, we would be using VS Code. Copy the python code from Twilio

image.png

Run the code

STEP 5

image.png

You would see this in the terminal.

Eureka!!! You got your message --->

IMG_20220716_095540.jpg

So, what are you waiting for?? Try out other features from Twilio, you can send personalized emails and WhatsApp messages too using the same process.

Happy Exploring!!