(subscribersPreferences)
- retrieve - Get subscriber preferences
listLegacy- Get subscriber preferences⚠️ Deprecated- updateGlobal - Update subscriber global preferences
Get subscriber global and workflow specific preferences
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
$sdk = novu\Novu::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$response = $sdk->subscribersPreferences->retrieve(
subscriberId: '<id>',
idempotencyKey: '<value>'
);
if ($response->getSubscriberPreferencesDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersControllerGetSubscriberPreferencesResponse
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 | */* |
Get subscriber preferences
⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
$sdk = novu\Novu::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$response = $sdk->subscribersPreferences->listLegacy(
subscriberId: '<id>',
includeInactiveChannels: false,
idempotencyKey: '<value>'
);
if ($response->updateSubscriberPreferenceResponseDtos !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
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 |
?Operations\SubscribersV1ControllerListSubscriberPreferencesResponse
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 subscriber global preferences
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'<YOUR_API_KEY_HERE>'
)
->build();
$updateSubscriberGlobalPreferencesRequestDto = new Components\UpdateSubscriberGlobalPreferencesRequestDto();
$response = $sdk->subscribersPreferences->updateGlobal(
subscriberId: '<id>',
updateSubscriberGlobalPreferencesRequestDto: $updateSubscriberGlobalPreferencesRequestDto,
idempotencyKey: '<value>'
);
if ($response->updateSubscriberPreferenceGlobalResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
updateSubscriberGlobalPreferencesRequestDto |
Components\UpdateSubscriberGlobalPreferencesRequestDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersV1ControllerUpdateSubscriberGlobalPreferencesResponse
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 | */* |