Official Python client for the ClickSend API — send and manage SMS, MMS, email, voice, fax, letters, postcards, and more.
Python 3.10+
pip install git+https://github.com/ClickSend/clicksend-python-v2.gitimport clicksend
from clicksend.rest import ApiException
configuration = clicksend.Configuration(
username=os.environ["CLICKSEND_USERNAME"],
password=os.environ["CLICKSEND_API_KEY"],
)
with clicksend.ApiClient(configuration) as api_client:
sms_api = clicksend.SmsApi(api_client)
try:
response = sms_api.send_sms(
send_sms_request={
"messages": [
{"source": "sdk", "body": "Hello from ClickSend!", "to": "+61411111111"}
]
}
)
print(response)
except ApiException as e:
print(f"Exception when calling SmsApi->send_sms: {e}")with clicksend.ApiClient(configuration) as api_client:
management_api = clicksend.ManagementApi(api_client)
try:
account = management_api.view_account_details()
print(account)
except ApiException as e:
print(f"Exception when calling ManagementApi->view_account_details: {e}")with clicksend.ApiClient(configuration) as api_client:
mms_api = clicksend.MmsApi(api_client)
try:
response = mms_api.send_mms(
send_mms_request={
"media_file": "https://clicksend.com/logo.png",
"messages": [
{
"to": "+61411111111",
"from": "sdk",
"subject": "Hello",
"body": "Hello from ClickSend!",
"source": "sdk",
}
],
}
)
print(response)
except ApiException as e:
print(f"Exception when calling MmsApi->send_mms: {e}")The API uses HTTP Basic authentication — your ClickSend username and API key (available from the ClickSend Dashboard).
Full API reference: https://developers.clicksend.com/docs/rest/v3/
Need help? Contact ClickSend Support or visit the Help Centre.