I have established a relationship between PostgreSQL and Python. I provide that send e-mail to a user with used Python. I want to send a message to specific user's phone.
I shared a part of my code:
I have established a relationship between PostgreSQL and Python. I provide that send e-mail to a user with used Python. I want to send a message to specific user's phone.
I shared a part of my code:
You could use the Amazon SNS service (Simple Notification Service). It's a REST service, so it can be used in any language, including Python.
See Using Amazon SNS for User Notifications with a Mobile Phone Number as a Subscriber (Send SMS).
There are many resources around.
from smsapi import SmsApi
username = "USERNAME"
password = "PASSWORD"
sms = SmsApi(username, password)
total_points = sms.get_points()['points']
print("You have", total_points, "points left")
cursor = conn.cursor()
list_of_client_numbers = cursor.execute('''SELECT mobNumber FROM clientsTable''')
for eachRecord in list_of_client_numbers:
sms = sms.send_sms(
recipient=eachRecord,
sender_name="YOUR COMPANY NAME",
message="MESSAGE",
eco=False)
conn.close()
total_points = sms.get_points()['points'] print("You have", total_points, "points left")