Download the PHP package waotomatis/sdk without Composer
On this page you can find all versions of the php package waotomatis/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waotomatis/sdk
More information about waotomatis/sdk
Files in waotomatis/sdk
Package sdk
Short Description Official PHP SDK for WAOtomatis — headless WhatsApp (WABA Cloud API).
License MIT
Homepage https://waotomatis.com
Informations about the package sdk
WAOtomatis PHP SDK
Official PHP SDK for WAOtomatis — headless WhatsApp infrastructure on the WhatsApp Business Platform (WABA Cloud API).
- Dependency-light: standard library only (cURL extension, with a pure-PHP stream fallback). No Guzzle, no PSR-7.
- Idiomatic: typed properties, strict types, exceptions extending a single
WaotomatisExceptionbase. - Mirrors the official TypeScript SDK's surface, error model, and webhook HMAC.
Requirements
- PHP 8.1+
ext-json(required);ext-curl(recommended — falls back to streams if absent)
Install
Quickstart
The client base URL defaults to https://api.waotomatis.com. Authentication is
sent as Authorization: Bearer <apiKey>.
Configuration
Transient failures (HTTP 408/429/500/502/503/504 and network errors) are retried
with exponential backoff + jitter, honoring the Retry-After header. Only
idempotent verbs — or requests carrying an idempotency key — are retried.
Sessions
Sending messages
There is one method per message type — eight in total. Across all of them $to
is the first argument, required fields are required arguments, optionals are
nullable (and dropped from the wire body when null), and the last argument is
always an optional $idempotencyKey. Each posts to its own endpoint and returns
['id' => ..., 'eventId' => ..., 'providerMessageId' => ..., 'status' => ...].
Text
sendText(to, text, previewUrl?, replyTo?, idempotencyKey?)
Media
sendMedia(to, type, mediaId?, link?, caption?, fileName?, voice?, replyTo?, idempotencyKey?)
One method covers image, video, audio, document, and sticker — the
media kind is the $type argument. Provide exactly one of $mediaId (from an
upload) or $link (a public URL). $caption applies to image/video/document,
$fileName to document, and $voice marks audio as a voice note.
Template
sendTemplate(to, name, languageCode, components?, replyTo?, idempotencyKey?)
$components is Meta's component array (header/body/buttons params), passed
through as-is.
Interactive
sendInteractive(to, type, bodyText?, headerText?, footerText?, buttons?, listButton?, sections?, ctaDisplayText?, ctaUrl?, flow?, catalogId?, productRetailerId?, productSections?, replyTo?, idempotencyKey?)
One method covers all interactive variants — the variant is the $type argument
(button, list, cta_url, flow, product, or product_list). Supply only
the fields that variant needs.
Reaction
sendReaction(to, messageId, emoji, idempotencyKey?)
React to a message by its provider wamid. Pass an empty $emoji to clear a
reaction you previously sent.
Location
sendLocation(to, latitude, longitude, name?, address?, replyTo?, idempotencyKey?)
Contacts
sendContacts(to, contacts, replyTo?, idempotencyKey?)
$contacts is an array of WhatsApp contact-card objects. Each card requires
name.formatted_name; phones, emails, org, urls, addresses, and
birthday are optional and passed through as-is.
Carousel
sendCarousel(to, name, languageCode, cards, bodyParams?, replyTo?, idempotencyKey?)
A carousel template: a named, language-tagged template with up to ten cards, each carrying its own media header, body params, and buttons.
Idempotency
Every send method takes an optional $idempotencyKey as its last argument. Pass
a key so a retried send returns the original result instead of duplicating:
Mark as read
Media upload & download
Templates
Manage WhatsApp message templates for a session (proxies Meta's WABA template
API). Reach them as $wao->sessions('sess_123')->templates.
A template object has the shape
{ id, name, language, status, category, components, quality_score? }. The
components array follows Meta's template-component schema
(HEADER/BODY/FOOTER/BUTTONS) and is passed through as-is.
Webhooks
The server signs each delivery with HMAC-SHA256 over the raw request body,
hex-encoded, in the X-Wao-Signature: sha256=<hex> header. Verify against the
exact bytes you received (never re-encode a parsed object).
constructEvent() throws WaotomatisException (code: unauthorized) on a bad
signature and (code: validation_failed) on an unparseable body.
Error handling
Every failure is a subclass of Waotomatis\Exception\WaotomatisException,
mirroring the server's { error: { code, message, requestId } } model plus the
HTTP status. Branch on getCodeName() for stable handling.
| Exception | HTTP | Notes |
|---|---|---|
AuthenticationError |
401 | Missing / invalid API key |
PermissionError |
403 | Key not permitted for this action |
NotFoundError |
404 | Resource not found / not visible |
ValidationError |
409 / 422 | Understood but rejected (validation, bad state) |
RateLimitError |
429 | getRetryAfter() returns seconds |
ApiError |
5xx | Unexpected server failure |
TimeoutError |
408 | Request exceeded the configured timeout |
ConnectionError |
— | Network failure before a response |
WaotomatisException |
other | Base class; other 4xx surface here |
License
MIT © WAOtomatis. See LICENSE.
All versions of sdk with dependencies
ext-json Version *