Skip to content

Latest commit

 

History

61 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nsupp REST SDK — PHP

Typed, dependency-free client for the nsupp /cof/v1 REST API (PHP 8.1+, ext-curl).

Handles HTTP Basic auth + the X-Cof-Tier header, unwraps the { error, data } envelope, throws Nsupp\NsuppError on failures, and gives you a website-scoped helper. Every endpoint is reachable — common ones as typed methods, the rest via request().

Install

composer require nsupp/rest

Quickstart

use Nsupp\Client;
use Nsupp\NsuppError;

$nsupp = new Client([
    'identifier' => getenv('NSUPP_IDENTIFIER'), // nsupp_pk_…
    'secret'     => getenv('NSUPP_SECRET'),
    'tier'       => 'plugin',
    'websiteId'  => '8f3c1d…',
    // 'baseUrl' => 'https://api.nsupp.com/cof',
]);

$site = $nsupp->website();

$website = $site->get();
$convos  = $site->listConversations(['page' => 1]);
$site->sendMessage('session_1', 'Hi 👋 — how can we help?');

// Connected-channel delivering replies (ticket / mail / marketplace / review):
$site->emailReply('session_1', 'Thanks — your order ships today.');
$site->marketplaceReply('session_2', 'It ships within 24 hours.');
$site->reviewReply('session_3', 'Thank you for the feedback!');

try {
    $site->getConversation('missing');
} catch (NsuppError $e) {
    error_log("{$e->status} {$e->errorCode} {$e->getMessage()}");
}

// Escape hatch — any endpoint:
$site->request('POST', '/helpdesk/article/a_1/alternate', ['body' => ['alternate_article_id' => 'a_2']]);

Run the self-test: composer test (or php tests/contract.php).

License

Licensed under the Apache License 2.0.

"nsupp" and the nsupp logo are trademarks of Asindie, Inc. The license grants no trademark rights — see the trademark policy for what use is permitted.

About

Read-only mirror of the nsupp PHP SDK (Packagist), generated from the private monorepo by CI. Do not open PRs here.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages