PATCH
/
v2
/
subscribers
/
{subscriberId}
/
preferences
import { Novu } from "@novu/api";

const novu = new Novu({
  secretKey: "YOUR_SECRET_KEY_HERE",
});

async function run() {
  const result = await novu.subscribers.preferences.update({
    channels: {},
  }, "<id>");

  // Handle the result
  console.log(result);
}

run();
{
  "global": {
    "enabled": true,
    "channels": {
      "email": true,
      "sms": true,
      "in_app": true,
      "chat": true,
      "push": true
    }
  },
  "workflows": [
    {
      "enabled": true,
      "channels": {
        "email": true,
        "sms": true,
        "in_app": true,
        "chat": true,
        "push": true
      },
      "overrides": [
        {
          "channel": "in_app",
          "source": "subscriber"
        }
      ],
      "workflow": {
        "slug": "<string>",
        "identifier": "<string>",
        "name": "<string>"
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

API key authentication. Allowed headers-- "Authorization: ApiKey <api_key>".

Headers

idempotency-key
string

A header for idempotency purposes

Path Parameters

subscriberId
string
required

Body

application/json
channels
object
required

Channel-specific preference settings

workflowId
string

If provided, update workflow specific preferences, otherwise update global preferences

Response

200
application/json
OK
global
object
required

Global preference settings

workflows
object[]
required

Workflow-specific preference settings