Integration
Messaging from plain PHP
No framework, no service container, no queue worker required. Construct the SDK with an API token and call the endpoint you need — it is a thin, typed layer over the REST API built on Guzzle.
Install
composer require waapi/waapi-php-sdk
Send a message
Actions run against a connected account through one method. The action name maps directly to the REST endpoint, so anything the API can do is reachable without waiting for an SDK release.
use WaAPI\WaAPISdk\WaAPISdk;
$sdk = new WaAPISdk('your-api-token');
$sdk->executeInstanceAction(123, 'send-message', [
'chatId' => '50664083362@c.us',
'message' => 'Your order has shipped.',
]);
Manage the account itself
Provisioning is part of the SDK, so a product that connects accounts on behalf of its own users never has to script the dashboard.
$instance = $sdk->createInstance();
// Show this to the user, then poll until they have scanned it
$qr = $sdk->getInstanceClientQrCode($instance->id);
$status = $sdk->getInstanceClientStatus($instance->id);
instances()
List every connected account on your token
getInstance()
Read one account
createInstance()
Provision a new one
updateInstance()
Change webhook and proxy settings
deleteInstance()
Remove an account
getInstanceClientStatus()
Connected, disconnected or waiting for a scan
getInstanceClientQrCode()
The code to link a device
getInstanceClientInfo()
Who the connected account is
executeInstanceAction()
Every messaging action
getInstanceRequestStatus()
Follow up an async request
createWebhookSubscription()
Subscribe to events
getWebhookSubscriptions()
List active subscriptions
Failures are typed
The SDK throws rather than returning a status code you have to remember to check.
use WaAPI\WaAPISdk\Exceptions\NotFoundException;
use WaAPI\WaAPISdk\Exceptions\ValidationException;
use WaAPI\WaAPISdk\Exceptions\FailedActionException;
try {
$sdk->executeInstanceAction(123, 'send-message', $payload);
} catch (ValidationException $e) {
// the payload was rejected — inspect $e->errors()
} catch (NotFoundException $e) {
// no such instance on this token
} catch (FailedActionException $e) {
// accepted but the action could not be carried out
}
A successful call means the platform accepted the message, not that it was delivered. Delivery confirmation arrives through the message acknowledgement webhook.
PHP questions
Requirements, framework fit and error handling.
-
No — this SDK is framework independent and runs on PHP 7.2 or newer with Guzzle 6 or 7. If you are on Laravel, waapi/waapi-laravel-sdk wraps this package and adds config, a webhook route and typed events.
-
They match the REST endpoints one to one — send-message, send-image, create-group and so on. Anything documented for the API can be passed to executeInstanceAction without an SDK update.
-
That the platform accepted the request. Delivery is reported separately through the message acknowledgement webhook, so treat a 200 as queued rather than as delivered.
-
Yes. The token is account-wide and every method takes the instance ID it should act on, so a multi-tenant product uses a single token and routes per tenant.
-
The free trial is the sandbox — connect an account, get a real instance and run against production endpoints. There is no separate test host with different behaviour to be surprised by later.
Connect an account and start sending
One flat rate per connected account. Unlimited messages, no approval process, no per-message invoice.