enhavo / cleverreach
CleverReach REST API v3 client
Installs: 5 388
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 8
Forks: 2
Open Issues: 0
Requires
- ext-json: *
- guzzlehttp/guzzle: ^6.5
- psr/log: ^1.1
Requires (Dev)
- monolog/monolog: ^1.24
- phpunit/phpunit: ^7.5
- symfony/dotenv: ^4.2
This package is auto-updated.
Last update: 2024-11-11 15:23:17 UTC
README
CleverReach REST API v3 client
This library makes it easy to interact with the CleverReach REST API v3.
Installation
composer require enhavo/cleverreach
Usage
Initialize an API manager
use Enhavo\Component\CleverReach\ApiManager; use Enhavo\Component\CleverReach\Http\SymfonyAdapter; $adapter = new SymfonyAdapter(); // Authorize your app by credentials $adapter->authorize('<CLIENT_ID>', '<CLIENT_SECRET>'); // Create the API manager $apiManager = new ApiManager($adapter);
Create an inactive subscriber
$response = $apiManager->createSubscriber( '<EMAIL>', '<GROUP_ID>', false, // not activated [ 'salutation' => 'Mr.', 'firstname' => 'John', 'lastname' => 'Doe', ] ); if (isset($response['id'])) { // ... }
Trigger Double-Opt-In email for an inactive subscriber
$response = $apiManager->triggerDoubleOptInEmail('<EMAIL>', '<FORM_ID>'); if (isset($response['success'])) { // ... }
Trigger Double-Opt-Out email for an active subscriber
$response = $apiManager->triggerDoubleOptOutEmail('<EMAIL>', '<FORM_ID>'); if (isset($response['success'])) { // ... }
Get subscriber
$response = $apiManager->getSubscriber('<EMAIL>', '<GROUP_ID>'); if (isset($response['id'])) { // ... }
Set active status of a subscriber
$response = $apiManager->getSubscriber('<EMAIL>', '<GROUP_ID>', '<TRUE_OR_FALSE>'); if (true === $response) { // ... }
Delete subscriber
$response = $apiManager->deleteSubscriber('<EMAIL>', '<GROUP_ID>'); if (true === $response) { // ... }