Skip to content

Commit 739e287

Browse files
authored
Send SMS updates to mobile phone
1 parent 99cf7d7 commit 739e287

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎Send-SMS.py‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from time import sleep
2+
from sinchsms import SinchSMS
3+
4+
# function for sending SMS
5+
def sendSMS():
6+
7+
# enter all the details
8+
# get app_key and app_secret by registering
9+
# a app on sinchSMS
10+
number = 'your_mobile_number'
11+
app_key = 'your_app_key'
12+
app_secret = 'your_app_secret'
13+
14+
# enter the message to be sent
15+
message = 'Hello Message!!!'
16+
17+
client = SinchSMS(app_key, app_secret)
18+
print("Sending '%s' to %s" % (message, number))
19+
20+
response = client.send_message(number, message)
21+
message_id = response['messageId']
22+
response = client.check_status(message_id)
23+
24+
# keep trying unless the status retured is Successful
25+
while response['status'] != 'Successful':
26+
print(response['status'])
27+
time.sleep(1)
28+
response = client.check_status(message_id)
29+
30+
print(response['status'])
31+
32+
if __name__ == "__main__":
33+
sendSMS()

0 commit comments

Comments
 (0)