Skip to content

Python SDK

Coming Soon

The official Python SDK is under development. In the meantime, use the REST API directly.

Preview

The Python SDK will provide a clean, typed interface:

python
from cube_connect_sdk import CubeConnect

cube = CubeConnect("YOUR_API_KEY")

# Send a template message
result = cube.messages.send_template(
    "+966501234567",
    "order_confirmation",
    params=["ORD-1234", "500 SAR"],
)

print(result.message_log_id)
print(result.status)  # "queued"

Requirements

  • Python 3.9+
  • httpx or requests

Installation (Coming Soon)

bash
pip install cubeconnect

Current Alternative

Use requests or httpx:

python
import requests

response = requests.post(
    "https://cubeconnect.io/api/v1/messages/send",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "whatsapp_account_id": "YOUR_WHATSAPP_ACCOUNT_ID",
        "phone": "+966501234567",
        "message_type": "template",
        "data": {
            "name": "order_confirmation",
            "language_code": "en_US",
            "components": [
                {"type": "body", "parameters": [
                    {"type": "text", "text": "ORD-1234"},
                    {"type": "text", "text": "500 SAR"},
                ]},
            ],
        },
    },
)

See the API Reference for the complete API specification.

CubeConnect WhatsApp Business Platform