Python sample code to use Reson8 SMS API
import requests
def convert_to_hex(msg_text):
retVal = ""
for c in msg_text:
retVal += "%04X" % ord(c)
return retVal
def send_sms(api_url, username, password, msg_body, msg_encoding, recipients, msg_header):
if(msg_encoding == "9" or msg_encoding == "10"):
msg_body=convert_to_hex(msg_body)
payload = {"SenderName": username, "Password": password, "MessageBody": msg_body, "Encoding": msg_encoding, "CountryCode": "", "AreaCode": "", "MessageRecipients": recipients, "MsgHeader": msg_header}
response = requests.post(api_url, data=payload)
if(response.status_code == 200):
return response.text
else:
return "Invalid response status-code: {0}".format(response.status_code)
svc_url = "https://www.reson8.ae/sms/usmsHttpMultiTypeReceiver.jsp"
print(send_sms(svc_url, "YOUR_RESON8_USERNAME", "YOUR_RESON8_PASSWORD", "SMS_TEXT", "MSG_ENCODING_AS_PER_SMS_TEXT", "RECIPIENT_MOBILE_NUMBER", "MSG_HEADER"))