Sms status : queued

Hi @pankajkumar.p and @ee17b110,

Refer the code below using request library and here is the documentation http://docs.karix.io/v2/#tag/Message. You will get the ACCOUNT ID and ACCOUNT TOKEN after creating your account on https://cloud.karix.io

import base64
import requests

url = "https://api.karix.io/message/"

username = "Copy your ACCOUNT ID"
password = "Copy your ACCOUNT TOKEN"



auth_str = '%s:%s' % (username, password)

b64_auth_str = base64.b64encode(auth_str)

Authorization = 'Basic %s' % b64_auth_str

print(Authorization)

payload = '{"channel":"sms","source":"+14154009186","destination":["+917768098790"],"content":{"text":"Testing the karix- Bolt IoT."},"events_url":"https://events.example.com/message"}'

headers = {
    'Content-Type': "application/json",
    'Authorization': Authorization,
    'Accept': "*/*",
    'Cache-Control': "no-cache",
    'Host': "api.karix.io",
    'accept-encoding': "gzip, deflate",
    'content-length': "211",
    'Connection': "keep-alive",
    'cache-control': "no-cache"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)  

You can also use the Karix pip packages. Check this link https://blog.karix.io/how-to-send-an-sms-using-python-helper-library

2 Likes