Open In App
Related Articles

Send SMS updates to mobile phone using python

Improve Article
Save Article
Like Article

If you are running any python script and want to send regular updates from your script to your mobile phone through SMS, you can use SinchSMS API to send SMS.
Approach : 
Create an app on Sinch and get the key and secret of the app and use these credentials in the following script to send SMS to your mobile.
Limitation of Sinch : 
If you don’t have any credits(you have to pay for credits), you can only send SMS to the registered mobile numbers on Sinch. 
You can use way2sms to send SMS to any number(I will be discussing how to use way2sms in another article), but without purchased credits, on way2sms also, you can’t send more than 100 SMS per day.


# python script for sending message update
import time
from time import sleep
from sinchsms import SinchSMS
# function for sending SMS
def sendSMS():
    # enter all the details
    # get app_key and app_secret by registering
    # a app on sinchSMS
    number = 'your_mobile_number'
    app_key = 'your_app_key'
    app_secret = 'your_app_secret'
    # enter the message to be sent
    message = 'Hello Message!!!'
    client = SinchSMS(app_key, app_secret)
    print("Sending '%s' to %s" % (message, number))
    response = client.send_message(number, message)
    message_id = response['messageId']
    response = client.check_status(message_id)
    # keep trying unless the status returned is Successful
    while response['status'] != 'Successful':
        response = client.check_status(message_id)
if __name__ == "__main__":

For the execution of the script, edit the number, app_key, and app_secret fields, and then simply run the script.
I have written a complete script for sending SMS updates to mobile phones using sinchSMS and way2sms by fetching the latest updates from our placement website( GitHub link: stayUpdated
Exercise: Create a python script that updates you on your mobile phone if the price of a particular product lowers down to a certain price on

Last Updated : 03 Jul, 2022
Like Article
Save Article
Similar Reads
Related Tutorials