PHPackages                             getokta/okta-connect-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. getokta/okta-connect-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

getokta/okta-connect-sdk
========================

Official PHP SDK for Okta Connect — the omnichannel messaging platform (WhatsApp first; SMS / Email to follow).

v0.6.0(1mo ago)01.3k↑33.3%MITPHPPHP ^8.2

Since May 7Pushed 1mo agoCompare

[ Source](https://github.com/getokta/okta-connect-sdk)[ Packagist](https://packagist.org/packages/getokta/okta-connect-sdk)[ RSS](/packages/getokta-okta-connect-sdk/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (12)Versions (7)Used By (0)

Okta Connect PHP SDK
====================

[](#okta-connect-php-sdk)

[![PHP Version](https://camo.githubusercontent.com/c9f64f714c636ba27a3bba6dfd52f98426832db1262747efa54b212d16943651/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d626c7565)](https://www.php.net/)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)[![Status](https://camo.githubusercontent.com/71cb9a97360b8841ddfc125fa85687761845a6d44b48b4de9b527a2d2dce2930/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d616c7068612d6f72616e6765)](#)

A framework-agnostic PHP client for the **Okta Connect** omnichannel messaging platform. WhatsApp ships first; SMS and email channels follow under the same client surface (`Okta\Connect\\*`). No Laravel dependency in the SDK code itself — a separate `getokta/okta-connect-sdk-laravel` bridge package will be published later.

Installation
------------

[](#installation)

```
composer require getokta/okta-connect-sdk
```

Quickstart
----------

[](#quickstart)

### Tenant scope (read / write / send)

[](#tenant-scope-read--write--send)

```
use Okta\Connect\WhatsApp\Client;

$client = new Client(
    baseUrl: 'https://connect.example.com',
    token: 'sanctum_token_here',
    options: ['timeout' => 30, 'retries' => 2],
);

$client->messages()->send([
    'channel_id' => '01H...',
    'to'         => '+9665...',
    'type'       => 'text',
    'text'       => ['body' => 'Hello'],
]);

$messages      = $client->messages()->list(['conversation_id' => '01H...', 'per_page' => 50]);
$conversations = $client->conversations()->list();
$conversation  = $client->conversations()->get($id);
$contacts      = $client->contacts()->list(['search' => '+966']);
$client->contacts()->upsert(['phone' => '+9665...', 'name' => 'Ali']);
$channels      = $client->channels()->list();
$client->webhooks()->register(['url' => 'https://...', 'events' => ['message.received']]);

// Meta message templates
$templates = $client->templates()->list(['status' => 'APPROVED', 'language' => 'ar']);
$client->templates()->send([
    'channel_id'    => '01H...',
    'wa_id'         => '966500000000',
    'template_name' => 'order_ready',
    'language'      => 'ar',
    'variables'     => ['12345', '120 SAR'],
]);

// WhatsApp groups (Baileys-only)
$group = $client->groups()->create('Sales pod', ['966500000000', '966500000001']);
$client->groups()->addParticipants($group->id, ['966500000002']);
```

### Platform-admin scope (`platform.admin` ability)

[](#platform-admin-scope-platformadmin-ability)

```
$client->admin()->workspaces()->create(['name' => 'Acme', 'slug' => 'acme']);
$client->admin()->workspaces()->list(['per_page' => 20]);
$client->admin()->workspaces()->get($ulid);
$client->admin()->workspaces()->update($ulid, ['display_name' => 'Acme Inc']);

$client->admin()->workspaceUsers()->create($workspaceId, [
    'name' => 'Ali', 'email' => 'ali@acme.com', 'password_auto' => true,
]);
$client->admin()->workspaceUsers()->list($workspaceId);

$client->admin()->workspaceTokens()->issue($workspaceId, [
    'name' => 'partner-app',
    'abilities' => ['read', 'send'],
    'user_id' => $userId,
]);

$client->admin()->workspaceChannels()->create($workspaceId, [
    'display_name' => 'Acme Main',
    'type'         => 'whatsapp_cloud',
]);
$client->admin()->workspaceChannels()->list($workspaceId);

// Platform transactional messaging (outbound-only; needs platform.admin or platform.inbox)
$client->admin()->messages()->transactional([
    'to'   => '+966500000000',
    'type' => 'text',
    'text' => 'Your order #1234 has shipped.',
]);
$client->admin()->messages()->otp([
    'to'          => '+966500000000',
    'code'        => '482915',
    'ttl_seconds' => 300,
    'purpose'     => 'two_factor',
    'locale'      => 'ar',
]);

// Embed-SSO secrets
$legacySecret = $client->admin()->embedSecret()->sync();              // iss=okta-web
$partner      = $client->admin()->embedSecret()->provision('salla', 'salla-app');
// $partner = ['label' => 'salla', 'issuer' => 'salla-app', 'secret' => '…', 'created' => true]
```

### Embedding the inbox (iframe)

[](#embedding-the-inbox-iframe)

Mint embed tokens and build iframe URLs natively — no hand-rolled JWTs. Fetch the shared secret once (`admin()->embedSecret()->sync()` or `provision()`), then:

```
use Okta\Connect\WhatsApp\Embed\EmbedUser;
use Okta\Connect\WhatsApp\Embed\UiHide;

$embed = $client->embed($sharedSecret);              // base URL reused from the client
$operator = new EmbedUser(sub: 'partner-user-7', email: 'op@acme.com', name: 'Op');

// Cookieless per-request flow (survives third-party-cookie blocking). The token
// rides every request inside the iframe — recommended for white-label embeds.
$src = $embed->inboxUrl($operator, uiHide: [UiHide::AI, UiHide::ASSIGN_AGENT]);
//
