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

const novu = new Novu({
  secretKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await novu.subscribers.preferences.updateLegacy({
    subscriberId: "<id>",
    workflowId: "<id>",
    updateSubscriberPreferenceRequestDto: {},
  });

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

run();
{
  "template": {
    "_id": "<string>",
    "name": "<string>",
    "critical": true,
    "triggers": [
      {
        "type": "event",
        "identifier": "<string>",
        "variables": [
          {
            "name": "<string>",
            "value": {},
            "type": "String"
          }
        ],
        "subscriberVariables": [
          {
            "name": "<string>",
            "value": {},
            "type": "String"
          }
        ],
        "reservedVariables": [
          {
            "type": "tenant",
            "variables": [
              "<string>"
            ]
          }
        ]
      }
    ]
  },
  "preference": {
    "enabled": true,
    "channels": {
      "email": true,
      "sms": true,
      "in_app": true,
      "chat": true,
      "push": true
    }
  }
}

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
parameter
string
required

Body

application/json

Response

200
application/json

OK

The response is of type object.