In our college days we most often forget our daily classes, right? To keep track of classes every day, we can send a Notification (i.e, ) SMS Alert regards their classes to their mobile phones using Python.
We need to use two functionalities: http module and MSG91 API for sending SMS.
Here we are importing the http client function in http module (since we are using our system as client and msg91 api service as server) and using HTTPSConnection function to establish the connection with SMS API Service (MSG91).
While establishing connection we need to send two main parameters in data packet (i.e) Header and Payload.
Header : In the header, We will send the authentication key of our MSG91 API. And of course, context text is nothing but context type that means the type of the payload. We are sending all the payload information in JSON format, so the context type will be JSON.
You need to create an account in MSG91 and you need to create an API key in MSG91 to send SMS.
Payload : Everyone knows that the payload is the important section through which the data is sent or received. Here we are sending the sender ID, route, country along with the message and a receiver mobile number. Where sender ID is nothing but the sender name. It must be of length 6 and should contain only alpha characters. If you want to send SMS internationally means use 0 as country code otherwise use 91 for India communication.
Now we need to send the connection request along with this header and payload. Here we use the POST method to establish the connection. Once the request is sent, the API will send the message to the receivers what we have mentioned as the JSON array. Then the API acknowledges us with the status code as 200 and a message as success.
- Send SMS updates to mobile phone using python
- Python | Send SMS using Twilio
- Send Text messages to any mobile number using Fast2SMS API in Python
- Python | SMS Bomber using Selenium
- Python | Get email alert when the website is up
- How to handle alert prompts in Selenium Python ?
- Send mail from your Gmail account using Python
- Send mail with attachment from your Gmail account using Python
- Send message to Telegram user using Python
- Send PDF File through Email using pdf-mail module
- Creating a Keras Callback to send notifications on WhatsApp
- Newspaper scraping using Python and News API
- Calculate distance and duration between two places using google distance matrix API in Python
- Querying Live running status and PNR of trains using Railway API in Python
- Speech Recognition in Python using Google Speech API
- Python | Get a set of places according to search query using Google Places API
- Get emotions of images using Microsoft emotion API in Python
- Python | URL shortener using tinyurl API
- Python | Find current weather of any city using openweathermap API
- Python | Calculate geographic coordinates of places using google geocoding API
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.