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

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

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

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

run();
{
  "_id": "<string>",
  "firstName": "<string>",
  "lastName": "<string>",
  "email": "<string>",
  "phone": "<string>",
  "avatar": "<string>",
  "locale": "<string>",
  "subscriberId": "<string>",
  "channels": [
    {
      "providerId": "slack",
      "integrationIdentifier": "<string>",
      "credentials": {
        "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"
      },
      "_integrationId": "<string>"
    }
  ],
  "topics": [
    "<string>"
  ],
  "isOnline": true,
  "lastOnlineAt": "<string>",
  "_organizationId": "<string>",
  "_environmentId": "<string>",
  "deleted": true,
  "createdAt": "<string>",
  "updatedAt": "<string>",
  "__v": 123,
  "data": {},
  "timezone": "<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
firstName
string | null

First name of the subscriber

lastName
string | null

Last name of the subscriber

email
string | null

Email address of the subscriber

phone
string | null

Phone number of the subscriber

avatar
string | null

Avatar URL or identifier

timezone
string | null

Timezone of the subscriber

locale
string | null

Locale of the subscriber

data
object | null

Additional custom data for the subscriber

Response

200
application/json
OK
subscriberId
string
required

The identifier used to create this subscriber, which typically corresponds to the user ID in your system.

_organizationId
string
required

The unique identifier of the organization to which the subscriber belongs.

_environmentId
string
required

The unique identifier of the environment associated with this subscriber.

deleted
boolean
required

Indicates whether the subscriber has been deleted.

createdAt
string
required

The timestamp indicating when the subscriber was created, in ISO 8601 format.

updatedAt
string
required

The timestamp indicating when the subscriber was last updated, in ISO 8601 format.

_id
string

The internal ID generated by Novu for your subscriber. This ID does not match the subscriberId used in your queries. Refer to subscriberId for that identifier.

firstName
string

The first name of the subscriber.

lastName
string

The last name of the subscriber.

email
string | null

The email address of the subscriber.

phone
string

The phone number of the subscriber.

avatar
string

The URL of the subscriber's avatar image.

locale
string

The locale setting of the subscriber, indicating their preferred language or region.

channels
object[]

An array of channel settings associated with the subscriber.

topics
string[]
deprecated

An array of topics that the subscriber is subscribed to.

isOnline
boolean

Indicates whether the subscriber is currently online.

lastOnlineAt
string

The timestamp indicating when the subscriber was last online, in ISO 8601 format.

__v
number

The version of the subscriber document.

data
object | null

Additional custom data for the subscriber

timezone
string

Timezone of the subscriber