Ozibus Developer PlatformDeveloper Platform Developer guide
API base https://api.ozibus.com.au/v1 Billing Prepaid PAYG via Ozibus Account Balance API & Developer Terms
Developer guide

Ozibus PHP SDK

Install the official Ozibus PHP SDK and make your first server-side API request.

Ozibus Developer Platform

The Ozibus PHP SDK provides a single client for SMS, transactional and marketing email, WhatsApp, Broadcast, Scheduling, Chat, and Account Balance APIs. This page documents every first-class service in the current SDK.

Install the SDK via Composer composer require ozibus/ozibus-php or download the ZIP file and extract it into your project.

Download PHP SDK (ZIP)

Requirements

  • PHP 7.4 or newer and the JSON extension
  • The cURL extension is recommended; PHP streams are the fallback transport.
  • A merchant ID and secret API key for server-side calls

Install the package

Extract the ZIP into your project, then load its bundled autoloader:

require __DIR__ . '/ozibus-php-sdk/src/autoload.php';

Create a client

Store credentials in protected server configuration. The SDK exchanges them for an access token and renews the token in memory before expiry. Your server must satisfy the merchant IP allowlist.

use Ozibus\Sdk\Client;

$ozibus = Client::make([
    'merchant_id' => getenv('OZIBUS_MERCHANT_ID'),
    'secret_key' => getenv('OZIBUS_SECRET_KEY'),
    'base_url' => 'https://api.ozibus.com.au/v1',
    'timeout' => 30,
]);

For a business-specific API key, also provide 'business_id' => 'YOUR_BUSINESS_UUID'. Omit it when using parent-merchant credentials.

First request

$response = $ozibus->sms()->send('+61400000000', 'YOUR_SENDER', 'Hello');

if ($response->failed()) {
    error_log($response->message());
} else {
    $data = $response->data();
}

The SDK returns an Ozibus\Sdk\Response. Check the response and provider delivery status before reporting a message as delivered. A timeout can happen after a provider accepts a send, so review its status before retrying to avoid duplicate charges.

Responses and errors

Every method returns Ozibus\Sdk\Response. successful() checks both the HTTP status and any response_code in the body. Use statusCode(), headers(), body(), data(), message(), code(), failed(), and toArray() to inspect results. Set 'throw' => true on the client to throw Ozibus\Sdk\OzibusException for unsuccessful API responses; transport failures and missing credentials also throw.

try {
    $response = $ozibus->wallet()->balance();
    $balance = $response->data();
} catch (\Ozibus\Sdk\OzibusException $e) {
    error_log($e->getMessage());
    error_log(json_encode($e->context()));
}

A queued or accepted send is not proof of recipient delivery. Check channel delivery status. A timeout can happen after acceptance, so reconcile status before retrying a billable send.

Merchant credentials and public keys

The SDK exchanges merchant credentials through GET /generate_token and caches the bearer token in this client instance. If your application supplies 'access_token' => $token, renew it yourself. A secret API key is not a bearer token. Use a separate client for each merchant or business.

Scheduling and chat widget helpers use a public key. Broadcast iframe and subscription helpers use it as a client key:

$publicOzibus = Client::make([
    'public_key' => getenv('OZIBUS_PUBLIC_KEY'),
    'base_url' => 'https://api.ozibus.com.au/v1',
]);

SMS and OTP

sms()->send($to, $from, $message, $options = []) posts to /sms. Use an approved sender ID where applicable. The optional array adds endpoint payload fields.

$ozibus->sms()->send('+61400000000', 'YOUR_SENDER', 'Appointment confirmed.');
$ozibus->sms()->requestOtp('+61400000000');
$ozibus->sms()->resendOtp('+61400000000');
$ozibus->sms()->verifyOtp('+61400000000', '123456');

The OTP helpers call /get_otp, /resend_otp, and /verify. Enforce expiry and resend rules in the consuming application.

Transactional email

email()->send($message) posts to /mail. Supply personalizations, a sender from a verified domain, subject, and content.

$response = $ozibus->email()->send([
    'personalizations' => [
        ['to' => [['email' => 'customer@example.com', 'name' => 'Customer']]],
    ],
    'from' => ['email' => 'hello@your-verified-domain.example', 'name' => 'Your team'],
    'subject' => 'Welcome',
    'content' => [
        ['type' => 'text/html', 'value' => '<p>Welcome to our service.</p>'],
    ],
]);
$verification = $ozibus->email()->verifyDeliverable('customer@example.com');

verifyDeliverable() calls /verify_email. Verification helps list hygiene but does not guarantee delivery.

Marketing email and subscribers

Subscriber operations are merchant and verified-domain scoped. Use a secret-key client, source_domain_id, and consented contacts. marketingEmail()->subscribe($subscriber) adds or restores a subscriber through /newsletter.

$response = $ozibus->marketingEmail()->subscribe([
    'firstname' => 'Ada',
    'lastname' => 'Lovelace',
    'subscription_email' => 'ada@example.com',
    'source_domain_id' => 'YOUR_VERIFIED_DOMAIN_ID',
    'tags' => ['newsletter', 'product-updates'],
]);

subscribers($query) calls /get-subscribers; use the returned subscriber ID when unsubscribing. unsubscribe($subscriber) calls /unsubscribe.

$list = $ozibus->marketingEmail()->subscribers([
    'source_domain_id' => 'YOUR_VERIFIED_DOMAIN_ID',
]);
$ozibus->marketingEmail()->unsubscribe([
    'id' => 'SUBSCRIBER_ID',
    'source_domain_id' => 'YOUR_VERIFIED_DOMAIN_ID',
]);

Legacy aliases remain available: email()->addSubscribers($payload), email()->subscribers($query), and email()->unsubscribe($payload) call these same endpoints.

WhatsApp

whatsapp()->send($to, $message, $options = []) posts to /whatsapp. The options array adds channel-specific payload fields when needed.

$response = $ozibus->whatsapp()->send(
    '+61400000000',
    'Your driver is on the way.'
);

Use valid recipient permission and approved templates or service windows where required.

Broadcast

Broadcast helpers use https://api.ozibus.com.au/broadcast. Iframe and subscription methods use the public client key. Dashboard and campaign methods use merchant credentials.

$token = $publicOzibus->broadcast()->iframeToken([
    'origin' => 'https://your-site.example',
]);
$publicOzibus->broadcast()->subscribe([
    'subscriber_id' => 'user-123',
    'channel' => 'in_app',
]);
$publicOzibus->broadcast()->unsubscribe([
    'subscriber_id' => 'user-123',
    'channel' => 'in_app',
]);

$merchantId = getenv('OZIBUS_MERCHANT_ID');
$dashboard = $ozibus->broadcast()->dashboard($merchantId);
$audience = $ozibus->broadcast()->audienceSummary($merchantId);
$campaigns = $ozibus->broadcast()->broadcasts($merchantId);

Additional merchant methods are action($merchantId, $broadcastId, $payload), uploadAsset($payload), and aiAssist($payload). Their endpoints are {merchantId}/broadcasts/{broadcastId}/action, upload-broadcast-asset, and ai-assist. Use broadcast()->request($method, $endpoint, $payload, $options) for other Broadcast endpoints. Supply the payload required by the selected action.

$ozibus->broadcast()->action($merchantId, 42, ['action' => 'pause']);
$asset = $ozibus->broadcast()->uploadAsset($assetPayload);
$suggestion = $ozibus->broadcast()->aiAssist($assistPayload);

Scheduling

Scheduling widget methods use the public client. Read configuration and office hours before presenting slots, then submit the chosen local time and timezone.

$config = $publicOzibus->scheduling()->config([
    'profession' => 'clinic',
    'timezone' => 'Australia/Melbourne',
]);
$hours = $publicOzibus->scheduling()->officeHours();
$colors = $publicOzibus->scheduling()->colors();
$booking = $publicOzibus->scheduling()->book([
    'firstname' => 'Ada',
    'lastname' => 'Lovelace',
    'email' => 'ada@example.com',
    'phone' => '+61400000000',
    'location' => 'Melbourne',
    'date' => '2026-11-01',
    'appointment_start' => '09:00',
    'appointment_end' => '09:30',
    'service_name' => 'Consultation',
    'timezone' => 'Australia/Melbourne',
]);

Other methods are portal($payload), reschedule($payload), cancel($payload), confirmWaitlistOffer($payload), and paymentEvent($payload). They post to appointment-portal, appointment-reschedule, appointment-cancel, waitlist-offer, and scheduling-payment-event. calendarSyncFeed($query) makes a GET request to calendar-sync-feed.

$publicOzibus->scheduling()->portal(['email' => 'ada@example.com']);
$publicOzibus->scheduling()->reschedule(['appointment_id' => 'APT-123']);
$publicOzibus->scheduling()->cancel(['appointment_id' => 'APT-123']);
$publicOzibus->scheduling()->confirmWaitlistOffer($offerPayload);
$publicOzibus->scheduling()->paymentEvent($paymentEventPayload);
$feed = $publicOzibus->scheduling()->calendarSyncFeed(['token' => 'feed-token']);

Follow-up actions may require values returned by an earlier scheduling call; the short payloads above illustrate SDK invocation only.

Customer chat

Chat widget methods use the public client. A session ID connects submitted messages with history and closure. Visitor messages should use sender_type set to user.

$config = $publicOzibus->chat()->widgetConfig(['profile_key' => 'default']);
$message = $publicOzibus->chat()->submit([
    'session_id' => 'session-123',
    'sender_type' => 'user',
    'message' => 'Hello, I need help.',
    'userName' => 'Ada',
    'userEmail' => 'ada@example.com',
]);
$history = $publicOzibus->chat()->history(['session_id' => 'session-123']);

Other public helpers are event($payload), knowledgeBase($payload), uploadFile($payload), deleteFile($payload), close($payload), emailTranscript($payload), syncHistory($payload), and aiReply($payload). They call widget-event, knowledge-base, upload-file, delete-file, close-chat, email-transcript, sync-history, and ai-chatbot-reply.

$publicOzibus->chat()->knowledgeBase(['query' => 'refund']);
$publicOzibus->chat()->event(['event' => 'opened']);
$publicOzibus->chat()->close(['session_id' => 'session-123']);
$publicOzibus->chat()->emailTranscript(['session_id' => 'session-123']);
$publicOzibus->chat()->uploadFile($filePayload);
$publicOzibus->chat()->deleteFile($fileReference);
$publicOzibus->chat()->syncHistory(['session_id' => 'session-123']);
$publicOzibus->chat()->aiReply($replyPayload);

Use the protected merchant client for chat()->billingSummary($payload), which posts to chat-billing-summary.

Account Balance and PAYG

wallet()->balance($payload = [], $options = []) posts to /balance with merchant authentication.

$balance = $ozibus->wallet()->balance();
if ($balance->successful()) {
    $account = $balance->data();
}

wallet()->request($endpoint, $payload, $options) posts to another supported balance endpoint. Confirm its contract before use; the SDK does not infer payment fields or semantics.

Generic requests and authentication modes

Use $ozibus->request($method, $endpoint, $payload = [], $options = []) for an endpoint without a first-class helper. The endpoint is relative to the configured API base URL. GET payloads become query parameters; other methods send JSON.

$response = $ozibus->request('POST', 'merchant-domains', [
    'domain' => 'your-site.example',
]);

$response = $ozibus->request('POST', 'sms', [
    'to' => '+61400000000',
    'from' => 'YOUR_SENDER',
    'message' => 'Hello',
], [
    'headers' => ['Idempotency-Key' => 'order-123-confirmation'],
]);

The auth option supports secret (default merchant credentials and bearer token), public (public key in payload or query), client_key (client key and X-Client-Key), and none (no SDK-managed credential). Use only a mode supported by the target endpoint.

Production guidance

  • Store merchant keys and bearer tokens only in protected server configuration.
  • Use approved sender identities, verified domains, consented audiences, and channel-specific policies.
  • Check HTTP status and Ozibus response code; a queued message is not recipient delivery.
  • Reconcile timed-out billable requests before retrying and use an idempotency key where supported.
  • Record safe failure context without logging credentials or sensitive message content.
Was this page useful?Your response helps us improve the developer journey.
Report a docs issue