(subscribers)
- create - Create subscriber
- get - Get subscriber
- patch - Patch subscriber
- delete - Delete subscriber
- search - Search for subscribers
- updatePreferences - Update subscriber global or workflow specific preferences
- createBulk - Bulk create subscribers
- list - Get subscribers
- updateCredentials - Update subscriber credentials
- updateOnlineStatus - Update subscriber online status
Create subscriber with the given data
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$createSubscriberRequestDto = new Components\CreateSubscriberRequestDto(
subscriberId: '<id>',
);
$response = $sdk->subscribers->create(
createSubscriberRequestDto: $createSubscriberRequestDto,
idempotencyKey: '<value>'
);
if ($response->subscriberResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
createSubscriberRequestDto |
Components\CreateSubscriberRequestDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersControllerCreateSubscriberResponse
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 by your internal id used to identify the subscriber
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$response = $sdk->subscribers->get(
subscriberId: '<id>',
idempotencyKey: '<value>'
);
if ($response->subscriberResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersControllerGetSubscriberResponse
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 | */* |
Patch subscriber by your internal id used to identify the subscriber
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$patchSubscriberRequestDto = new Components\PatchSubscriberRequestDto();
$response = $sdk->subscribers->patch(
subscriberId: '<id>',
patchSubscriberRequestDto: $patchSubscriberRequestDto,
idempotencyKey: '<value>'
);
if ($response->subscriberResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
patchSubscriberRequestDto |
Components\PatchSubscriberRequestDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersControllerPatchSubscriberResponse
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 | */* |
Deletes a subscriber entity from the Novu platform
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$response = $sdk->subscribers->delete(
subscriberId: '<id>',
idempotencyKey: '<value>'
);
if ($response->removeSubscriberResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersControllerRemoveSubscriberResponse
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 | */* |
Search for subscribers
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Operations;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$request = new Operations\SubscribersControllerSearchSubscribersRequest();
$response = $sdk->subscribers->search(
request: $request
);
if ($response->listSubscribersResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\SubscribersControllerSearchSubscribersRequest | ✔️ | The request object to use for the request. |
?Operations\SubscribersControllerSearchSubscribersResponse
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 or workflow specific preferences
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$patchSubscriberPreferencesDto = new Components\PatchSubscriberPreferencesDto(
channels: new Components\PatchPreferenceChannelsDto(),
);
$response = $sdk->subscribers->updatePreferences(
subscriberId: '<id>',
patchSubscriberPreferencesDto: $patchSubscriberPreferencesDto,
idempotencyKey: '<value>'
);
if ($response->getSubscriberPreferencesDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
patchSubscriberPreferencesDto |
Components\PatchSubscriberPreferencesDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersControllerUpdateSubscriberPreferencesResponse
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 | */* |
Using this endpoint you can create multiple subscribers at once, to avoid multiple calls to the API.
The bulk API is limited to 500 subscribers per request.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$bulkSubscriberCreateDto = new Components\BulkSubscriberCreateDto(
subscribers: [
new Components\CreateSubscriberRequestDto(
subscriberId: '<id>',
),
],
);
$response = $sdk->subscribers->createBulk(
bulkSubscriberCreateDto: $bulkSubscriberCreateDto,
idempotencyKey: '<value>'
);
if ($response->bulkCreateSubscriberResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
bulkSubscriberCreateDto |
Components\BulkSubscriberCreateDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersV1ControllerBulkCreateSubscribersResponse
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 | */* |
Returns a list of subscribers, could paginated using the page
and limit
query parameter
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$responses = $sdk->subscribers->list(
page: 7685.78,
limit: 10,
idempotencyKey: '<value>'
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
page |
?float | ➖ | N/A |
limit |
?float | ➖ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersV1ControllerListSubscribersResponse
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 | */* |
Subscriber credentials associated to the delivery methods such as slack and push tokens.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$updateSubscriberChannelRequestDto = new Components\UpdateSubscriberChannelRequestDto(
providerId: Components\UpdateSubscriberChannelRequestDtoProviderId::PushWebhook,
credentials: new Components\ChannelCredentials(
webhookUrl: 'https://example.com/webhook',
channel: 'general',
deviceTokens: [
'token1',
'token2',
'token3',
],
alertUid: '12345-abcde',
title: 'Critical Alert',
imageUrl: 'https://example.com/image.png',
state: 'resolved',
externalUrl: 'https://example.com/details',
),
);
$response = $sdk->subscribers->updateCredentials(
subscriberId: '<id>',
updateSubscriberChannelRequestDto: $updateSubscriberChannelRequestDto,
idempotencyKey: '<value>'
);
if ($response->subscriberResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
updateSubscriberChannelRequestDto |
Components\UpdateSubscriberChannelRequestDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersV1ControllerUpdateSubscriberChannelResponse
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 | */* |
Used to update the subscriber isOnline flag.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$updateSubscriberOnlineFlagRequestDto = new Components\UpdateSubscriberOnlineFlagRequestDto(
isOnline: false,
);
$response = $sdk->subscribers->updateOnlineStatus(
subscriberId: '<id>',
updateSubscriberOnlineFlagRequestDto: $updateSubscriberOnlineFlagRequestDto,
idempotencyKey: '<value>'
);
if ($response->subscriberResponseDto !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
subscriberId |
string | ✔️ | N/A |
updateSubscriberOnlineFlagRequestDto |
Components\UpdateSubscriberOnlineFlagRequestDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\SubscribersV1ControllerUpdateSubscriberOnlineFlagResponse
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 | */* |