Instantly share code, notes, and snippets.

Embed
What would you like to do?
# INSTALL CALLR
# pip install callr
# INITIALIZATION
import callr
api = callr.Api("login","password")
# CREATING THE SAMPLE LIST
recipient_list = [ {'name' : 'Bob', 'phonenumber' : '+33628084544', 'order' : 'potatoes', 'dtime' : '4PM on 07/14/2017'},
{'name' : 'Michel', 'phonenumber' : '+33628084544', 'order' : 'bananas', 'dtime' : '8AM on 07/12/2017'}]
# DEFINE THE FUNCTION TO SEND EACH CLIENT SMS AND MAKE IT LOOP THROUGH RECIPIENT LIST
def SendSMS(recipient_list):
for i, item in enumerate(recipient_list):
recipient = recipient_list[i]["phonenumber"]
message = "Hello %s, Your order of %s is on its way, expect delivery at %s" % (recipient_list[i]["name"], recipient_list[i]["order"], recipient_list[i]["dtime"])
optionsSMS = { 'nature' : 'ALERTING'}
api.call('sms.send', 'SMS', recipient, message, optionsSMS)
SendSMS(recipient_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment