Send SMS to your Mobile number using APIs
Use Twilio's Messaging API to send SMS from your command line
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
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
Create a new account
Verify your email
Get a Twilio phone number by choosing the trial pack
STEP 2
After you are done with STEP 1, Your Twilio account would look like this
Note- Account SID and Auth token are important and confidential
Click here to Try out the SMS service
You would see -
Fill in your Messaging SID, the Phone number to which you want to send, and the text message.
You would notice code snippets like this with a variety of programming languages-->
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.
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.
STEP 4
Open any IDE. In this case, we would be using VS Code. Copy the python code from Twilio
Run the code
STEP 5
You would see this in the terminal.
Eureka!!! You got your message --->
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!!