NovuN
Novu9mo ago
MG

Subscriber Preferences not reflected in Get Preferences API and when triggering a workflow

Dear Support,
we creating and updating Subscribers preferences via API (currently testing this integration via PostMan and with Novu configured as self hosted using Docker images version 2.1.1).
What is happening is that the preferences seems to be reflected in the MongoDB and in the Get Subscriber API, but when calling the Get Subscriber Preferences API we can't see them reflected at all; moreover, the subscriber preferences are not considered when triggering the workflow steps (e.g. email:false is still triggering the email, even though the workflow is not marked as "critical").
Is something that we are doing wrong? Please see below the list of API calls that we are making to create, update and get the subscriber and its preferences:

Create subscriber API:
curl --location 'http://localhost:3000/v1/subscribers' \
--header 'Authorization: ApiKey <AK>' \
--header 'Content-Type: application/json' \
--data-raw '{
"subscriberId": "1234",
"email": "redacted@example.com",
"firstName": "M",
"lastName": "G",
"phone": "+1234567890",
"data" :{}
}'

Update preferences API:
curl --location --request PATCH 'http://localhost:3000/v2/subscribers/1234' \
--header 'Authorization: ApiKey <AK>' \
--header 'Content-Type: application/json' \
--data '{
"channels": {
"email": false,
"in_app": true
}
}'

Get Subscriber API response:
{
"data": {
"firstName": "M",
"lastName": "G",
"email": "redacted@example.com",
"phone": "+1234567890",
"subscriberId": "1234",
"deleted": false,
"data": {},
"channels": [
{
"email": false,
"in_app": true
}
]
}
}

Get Subscriber preferences API:
curl --location 'http://localhost:3000/v2/subscribers/1234/preferences' \
--header 'Authorization: ApiKey <AK>' \
--header 'Content-Type: application/json' \
--data ''
Response:
{
"data": {
"global": {
"enabled": true,
"channels": {
"email": true,
"sms": true,
"in_app": true
}
},
"workflows": [...]
Was this page helpful?