(subscribers->preferences)
getByLevel- Get subscriber preferences by level⚠️ Deprecated- update - Update subscriber preference
Get subscriber preferences by level
⚠️ 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;
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
}
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 |
?Operations\SubscribersV1ControllerGetSubscriberPreferenceByLevelResponse
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 preference
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
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
workflowId |
string | ✔️ | N/A |
updateSubscriberPreferenceRequestDto |
Components\UpdateSubscriberPreferenceRequestDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersV1ControllerUpdateSubscriberPreferenceResponse
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 | */* |