Download the PHP package omnifox/sdk without Composer
On this page you can find all versions of the php package omnifox/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package sdk
Short Description Official PHP SDK for the Omnifox.io REST API: inbox, contacts, CRM, boards, calendar, catalog, orders, quotes, workflows and reports.
License MIT
Homepage https://omnifox.io/sdk
Informations about the package sdk
omnifox/sdk
Official PHP SDK for the Omnifox.io REST API.
Omnifox is an omnichannel customer messaging platform (WhatsApp, Instagram, Messenger, Telegram, TikTok, email, webchat, SMS) with a shared inbox, AI agents, CRM, boards, calendar, product catalog, orders and quotes. This SDK wraps the v1 REST API documented at https://omnifox.io/docs.
- PHP 8.1+, PSR-18 transport (Guzzle by default), PSR-4 autoloading.
- Same 25 resources and method names as the Node and Python SDKs, in idiomatic camelCase PHP.
- Typed exceptions, automatic retries on 429 / 5xx, and a lazy iterator for every listing.
- Verified end to end against a live workspace: 212 calls (every public method except the irreversible
channels->create/disconnect,broadcasts->createandworkspaces->create/delete), 0 failures before release (seetests/e2e).
Install
The package is on Packagist: https://packagist.org/packages/omnifox/sdk. If Packagist is not reachable from your network, install it straight from GitHub:
Quickstart (plain PHP)
Results are associative arrays, already unwrapped from the API's {success, message, data} envelope.
Laravel
Add the credentials to config/services.php:
Bind one client in App\Providers\AppServiceProvider::register():
Then inject it anywhere:
Authentication
Create a token in Omnifox under Settings > API keys and pass it as apiKey. The SDK sends Authorization: Bearer <token> on every request.
Workspaces
Tokens from the API-keys screen are pinned to one workspace, and the server resolves it from the token, so workspaceId is optional for them. If you do set it, it must match the token's workspace (a mismatch is a deliberate 403).
Set it anyway when you can: four endpoints validate workspace_id as a required body field however the token is scoped: users->setAgentStatus(), teams->create(), channels->create() and broadcasts->create(). With workspaceId configured the SDK fills it in; without it those four throw Omnifox\Exception\InvalidArgumentException before any request is sent, instead of an opaque 422.
The workspace travels as the workspace_id query parameter. The X-Workspace-Id header is not read by the API, so the SDK never sends it.
Identifiers
Every contact method accepts a numeric id or a kind:value selector, URL-encoded for you:
Pagination
list() returns a lazy Omnifox\Pagination\Paginator; iterate it and pages are fetched as needed. listPage() returns one Omnifox\Pagination\Page.
The API answers listings with four envelopes (plain, paginated() with top-level meta, a Laravel paginator inside data, and ?pagination=cursor). The paginator understands all four: it asks for cursor mode and falls back to ?page=N on endpoints that ignore it, so it never stops after the first page. It hard-stops at 500 pages.
Errors
Every exception implements Omnifox\Exception\OmnifoxException.
| Exception | When |
|---|---|
AuthenticationException |
401: token missing, wrong or revoked |
PaymentRequiredException |
402: the plan or wallet does not cover it |
PermissionDeniedException |
403: plan gate, token ability (read:crm, write:projects...), workspace mismatch |
NotFoundException |
404: does not exist, or belongs to another workspace |
ConflictException |
409: e.g. booking a calendar slot that is taken |
ValidationException |
422: getFieldErrors() returns Laravel's field => messages map |
RateLimitException |
429 after retries: getRetryAfter() in seconds |
ServerException |
5xx after retries |
ApiException |
base class of all of the above: getStatusCode(), getErrorCode(), getDetails(), getRequestId(), getBody() |
NetworkException |
no HTTP response (DNS, TLS, refused, timeout) |
InvalidArgumentException |
rejected locally, before any request |
429 and 5xx answers and connection failures are retried with exponential backoff and jitter (honouring Retry-After), maxRetries times (default 3). Timeouts are not retried.
Per-call options
Every write method takes a last $options argument, as an array or a RequestOptions:
For any route without a dedicated method there is an escape hatch with the same auth, workspace and retry handling: $omnifox->request('GET', '/me/notifications') (unwrapped) or $omnifox->requestRaw(...) (whole body).
Resources
| Property | Methods |
|---|---|
contacts |
list, listPage, get, search, listViaDsl, create, upsert, update, delete, merge, openConversation, closeConversation, assignConversation, setConversationStatus, comment, channels, attachTag, detachTag, attachTagsByName, detachTagsByName, sendMessage, listMessages, getMessage |
conversations |
list, listPage, get, create, assign, close, reopen, addNote, listMessages, sendMessage, getMessage, windowStatus |
messages |
send |
channels |
list, listPage, get, create, disconnect, health, templates |
broadcasts |
list, listPage, get, create, cancel |
customFields |
list, listPage, get, create, update, delete |
tags, snippets, workspaces |
list, listPage, get, create, update, delete |
webhooks |
list, listPage, get, create, update, delete, rotateSecret |
workflows |
list, listPage, get, activate, deactivate, trigger |
users |
me, logout, listAgents, listAgentsPage, getAgent, setAgentStatus |
teams |
list, listPage, get, create, update, delete, addMember, removeMember |
companies |
list, listPage, get, create, update, delete, attachContact, detachContact |
deals |
list, listPage, get, create, update, delete, moveToStage, close, timeline, board, bulk |
pipelines |
list, get, create, update, delete, createStage, updateStage, deleteStage |
crmActivities |
list, listPage, create, get, update, complete, delete |
boards |
list, get, view, columns, activity, create, update, delete, duplicate, createGroup |
boardItems |
create, get, update, delete, duplicate, move, setCellValue, listUpdates, addUpdate |
appointments |
listCalendars, listServices, slots, list, book, update, cancel |
products |
list, listPage, get, create, update, delete |
orders |
list, listPage, get, create, update, setStatus, recordPayment, delete |
catalogSettings |
get, update, applyPreset |
quotes |
list, listPage, get, create, update, delete, send, markViewed, accept, reject, pdf, billingEntities |
reports |
overview, conversations, agents, heatmap, crmFunnel, crmForecast, crmWinLossReasons |
Conversations
Contacts
CRM
CRM routes need the CRM plan feature and, on scoped tokens, read:crm / write:crm.
Calendar and video meetings
Catalog, orders and quotes
Boards
Notes for PHP specifically
- PHP encodes an empty array as
[], never{}. A top-level empty body is sent as{}; for a nested empty object passnew \stdClass(). - Query booleans are sent as
1/0, which Laravel'sbooleanrule accepts. - Decoded JSON objects come back as arrays, so an empty object from the server (
settings: []) and an empty list look the same.
Development
License
MIT
All versions of sdk with dependencies
ext-json Version *
guzzlehttp/guzzle Version ^7.5
guzzlehttp/psr7 Version ^2.4
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0