nsupp / rest
Official PHP SDK for the nsupp /cof/v1 REST API (zero dependencies, cURL). HTTP Basic + X-Cof-Tier auth, envelope handling, website-scoped helpers.
Requires
- php: >=8.1
- ext-curl: *
- ext-json: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
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.