Skip to content

Latest commit

 

History

History
127 lines (88 loc) · 9.35 KB

README.md

File metadata and controls

127 lines (88 loc) · 9.35 KB

Preferences

(subscribers->preferences)

Overview

Available Operations

  • getByLevel - Get subscriber preferences by level ⚠️ Deprecated
  • update - Update subscriber preference

getByLevel

Get subscriber preferences by level

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Operations;

$sdk = novu\Novu::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();



$response = $sdk->subscribers->preferences->getByLevel(
    preferenceLevel: Operations\Parameter::Global,
    subscriberId: '<id>',
    includeInactiveChannels: false,
    idempotencyKey: '<value>'

);

if ($response->getSubscriberPreferencesResponseDtos !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
preferenceLevel Operations\Parameter ✔️ the preferences level to be retrieved (template / global)
subscriberId string ✔️ N/A
includeInactiveChannels ?bool A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true
idempotencyKey ?string A header for idempotency purposes

Response

?Operations\SubscribersV1ControllerGetSubscriberPreferenceByLevelResponse

Errors

Error Type Status Code Content Type
Errors\ErrorDto 414 application/json
Errors\ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Errors\ValidationErrorDto 422 application/json
Errors\ErrorDto 500 application/json
Errors\APIException 4XX, 5XX */*

update

Update subscriber preference

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use novu;
use novu\Models\Components;

$sdk = novu\Novu::builder()
    ->setSecurity(
        '<YOUR_API_KEY_HERE>'
    )
    ->build();

$updateSubscriberPreferenceRequestDto = new Components\UpdateSubscriberPreferenceRequestDto();

$response = $sdk->subscribers->preferences->update(
    subscriberId: '<id>',
    workflowId: '<id>',
    updateSubscriberPreferenceRequestDto: $updateSubscriberPreferenceRequestDto,
    idempotencyKey: '<value>'

);

if ($response->updateSubscriberPreferenceResponseDto !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
subscriberId string ✔️ N/A
workflowId string ✔️ N/A
updateSubscriberPreferenceRequestDto Components\UpdateSubscriberPreferenceRequestDto ✔️ N/A
idempotencyKey ?string A header for idempotency purposes

Response

?Operations\SubscribersV1ControllerUpdateSubscriberPreferenceResponse

Errors

Error Type Status Code Content Type
Errors\ErrorDto 414 application/json
Errors\ErrorDto 400, 401, 403, 404, 405, 409, 413, 415 application/json
Errors\ValidationErrorDto 422 application/json
Errors\ErrorDto 500 application/json
Errors\APIException 4XX, 5XX */*