Skip to content

SDKs

Official client libraries to integrate CubeConnect into your application.

Available SDKs

SDKLanguagePackageStatus
PHP SDK (Laravel)PHP 8.1+ / Laravel 10+cubesoftware/cube-connect-sdk-phpAvailable
JavaScript SDKNode.js 18+ / Browser@cubesoftware/cube-connect-sdk-jsAvailable
Python SDKPython 3.9+Coming Soon

Why Use an SDK?

While you can call the REST API directly, SDKs provide:

  • Type safety - Typed request and response objects
  • Error handling - Structured exceptions with error codes
  • Convenience - Automatic phone normalization and component formatting
  • Authentication - Built-in API key management
  • Campaigns - createCampaign, getCampaign, cancelCampaign methods
  • Scheduling - Pass scheduledAt + timezone to defer any message

Direct API Usage

If you prefer to call the REST API directly:

php
// Using Laravel HTTP client
$response = Http::withToken(env('CUBECONNECT_API_KEY'))
    ->post('https://cubeconnect.io/api/v1/messages/send', [
        'whatsapp_account_id' => env('CUBECONNECT_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'],
                ]],
            ],
        ],
    ]);
javascript
// Using fetch
const response = await fetch('https://cubeconnect.io/api/v1/messages/send', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    whatsapp_account_id: process.env.CUBECONNECT_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' },
        ]},
      ],
    },
  }),
})
python
# Using requests
import requests

response = requests.post(
    'https://cubeconnect.io/api/v1/messages/send',
    headers={'Authorization': f'Bearer {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'},
                ]},
            ],
        },
    },
)

CubeConnect WhatsApp Business Platform