Subscribers
Retrieve subscriber preferences
Retrieve subscriber preferences using the Novu REST API. Requires your environment secret key in the Authorization header.
GET
/
v2
/
subscribers
/
{subscriberId}
/
preferences
PHP
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Operations;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$response = $sdk->subscribersPreferences->list(
subscriberId: '<id>',
criticality: Operations\Criticality::NonCritical,
contextKeys: [
'tenant:acme',
]
);
if ($response->getSubscriberPreferencesDto !== null) {
// handle response
}{
"global": {
"enabled": true,
"channels": {
"email": true,
"sms": false,
"in_app": true,
"chat": false,
"push": true
},
"schedule": {
"isEnabled": true,
"weeklySchedule": {
"monday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"tuesday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"wednesday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"thursday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"friday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"saturday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"sunday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
}
}
}
},
"workflows": [
{
"enabled": true,
"channels": {
"email": true,
"sms": false,
"in_app": true,
"chat": false,
"push": true
},
"overrides": [
{}
],
"workflow": {
"slug": "<string>",
"identifier": "<string>",
"name": "<string>",
"updatedAt": "<string>"
},
"updatedAt": "<string>"
}
]
}Authorizations
API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".
Headers
A header for idempotency purposes
Path Parameters
The identifier of the subscriber
Query Parameters
Available options:
critical, nonCritical, all Context keys for filtering preferences (e.g., ["tenant:acme"])
Was this page helpful?
⌘I
PHP
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Operations;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$response = $sdk->subscribersPreferences->list(
subscriberId: '<id>',
criticality: Operations\Criticality::NonCritical,
contextKeys: [
'tenant:acme',
]
);
if ($response->getSubscriberPreferencesDto !== null) {
// handle response
}{
"global": {
"enabled": true,
"channels": {
"email": true,
"sms": false,
"in_app": true,
"chat": false,
"push": true
},
"schedule": {
"isEnabled": true,
"weeklySchedule": {
"monday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"tuesday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"wednesday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"thursday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"friday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"saturday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
},
"sunday": {
"isEnabled": true,
"hours": [
{
"start": "09:00 AM",
"end": "05:00 PM"
}
]
}
}
}
},
"workflows": [
{
"enabled": true,
"channels": {
"email": true,
"sms": false,
"in_app": true,
"chat": false,
"push": true
},
"overrides": [
{}
],
"workflow": {
"slug": "<string>",
"identifier": "<string>",
"name": "<string>",
"updatedAt": "<string>"
},
"updatedAt": "<string>"
}
]
}