Skip to content

ClickSend/clicksend-python-v2

Repository files navigation

ClickSend Python SDK

Official Python client for the ClickSend API — send and manage SMS, MMS, email, voice, fax, letters, postcards, and more.

Requirements

Python 3.10+

Installation

pip install git+https://github.com/ClickSend/clicksend-python-v2.git

Getting Started

import 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}")

More Examples

View account details

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}")

Send an MMS

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}")

Authentication

The API uses HTTP Basic authentication — your ClickSend username and API key (available from the ClickSend Dashboard).

Documentation

Full API reference: https://developers.clicksend.com/docs/rest/v3/

Support

Need help? Contact ClickSend Support or visit the Help Centre.

About

Repo for a new and improved python SDKs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages