Update subscriber online status

Used to update the subscriber isOnline flag.

PATCH
/v1/subscribers/{subscriberId}/online-status

Authorization

Authorization<token>

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

In: header

Request Body

application/jsonRequired
isOnlineRequiredboolean

Path Parameters

subscriberIdRequiredstring

Header Parameters

idempotency-keystring

A header for idempotency purposes

Response Body

OK

_idstring

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.

firstNamestring

The first name of the subscriber.

lastNamestring

The last name of the subscriber.

emailstring | null

The email address of the subscriber.

phonestring

The phone number of the subscriber.

avatarstring

The URL of the subscriber's avatar image.

localestring

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

subscriberIdRequiredstring

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

channelsarray<object>

An array of channel settings associated with the subscriber.

@minItems 0

topicsDeprecatedarray<string>

An array of topics that the subscriber is subscribed to.

@minItems 0

isOnlineboolean

Indicates whether the subscriber is currently online.

lastOnlineAtstring

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

_organizationIdRequiredstring

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

_environmentIdRequiredstring

The unique identifier of the environment associated with this subscriber.

deletedRequiredboolean

Indicates whether the subscriber has been deleted.

createdAtRequiredstring

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

updatedAtRequiredstring

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

__vnumber

The version of the subscriber document.

dataobject | null

Additional custom data for the subscriber

timezonestring

Timezone of the subscriber

export interface Response {
  /**
   * 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.
   */
  _id?: string;
  /**
   * The first name of the subscriber.
   */
  firstName?: string;
  /**
   * The last name of the subscriber.
   */
  lastName?: string;
  /**
   * The email address of the subscriber.
   */
  email?: string | null;
  /**
   * The phone number of the subscriber.
   */
  phone?: string;
  /**
   * The URL of the subscriber's avatar image.
   */
  avatar?: string;
  /**
   * The locale setting of the subscriber, indicating their preferred language or region.
   */
  locale?: string;
  /**
   * The identifier used to create this subscriber, which typically corresponds to the user ID in your system.
   */
  subscriberId: string;
  /**
   * An array of channel settings associated with the subscriber.
   *
   * @minItems 0
   */
  channels?: ChannelSettingsDto[];
  /**
   * @deprecated
   * An array of topics that the subscriber is subscribed to.
   *
   * @minItems 0
   */
  topics?: string[];
  /**
   * Indicates whether the subscriber is currently online.
   */
  isOnline?: boolean;
  /**
   * The timestamp indicating when the subscriber was last online, in ISO 8601 format.
   */
  lastOnlineAt?: string;
  /**
   * The unique identifier of the organization to which the subscriber belongs.
   */
  _organizationId: string;
  /**
   * The unique identifier of the environment associated with this subscriber.
   */
  _environmentId: string;
  /**
   * Indicates whether the subscriber has been deleted.
   */
  deleted: boolean;
  /**
   * The timestamp indicating when the subscriber was created, in ISO 8601 format.
   */
  createdAt: string;
  /**
   * The timestamp indicating when the subscriber was last updated, in ISO 8601 format.
   */
  updatedAt: string;
  /**
   * The version of the subscriber document.
   */
  __v?: number;
  /**
   * Additional custom data for the subscriber
   */
  data?: {
    [k: string]: unknown;
  } | null;
  /**
   * Timezone of the subscriber
   */
  timezone?: string;
}
export interface ChannelSettingsDto {
  /**
   * The provider identifier for the credentials
   */
  providerId:
    | "slack"
    | "discord"
    | "msteams"
    | "mattermost"
    | "ryver"
    | "zulip"
    | "grafana-on-call"
    | "getstream"
    | "rocket-chat"
    | "whatsapp-business"
    | "fcm"
    | "apns"
    | "expo"
    | "one-signal"
    | "pushpad"
    | "push-webhook"
    | "pusher-beams";
  /**
   * The integration identifier
   */
  integrationIdentifier?: string;
  /**
   * Credentials payload for the specified provider
   */
  credentials: ChannelCredentials;
  /**
   * The unique identifier of the integration associated with this channel.
   */
  _integrationId: string;
}
export interface ChannelCredentials {
  /**
   * Webhook URL used by chat app integrations. The webhook should be obtained from the chat app provider.
   */
  webhookUrl?: string;
  /**
   * Channel specification for Mattermost chat notifications.
   */
  channel?: string;
  /**
   * Contains an array of the subscriber device tokens for a given provider. Used on Push integrations.
   *
   * @minItems 0
   */
  deviceTokens?: string[];
  /**
   * Alert UID for Grafana on-call webhook payload.
   */
  alertUid?: string;
  /**
   * Title to be used with Grafana on-call webhook.
   */
  title?: string;
  /**
   * Image URL property for Grafana on-call webhook.
   */
  imageUrl?: string;
  /**
   * State property for Grafana on-call webhook.
   */
  state?: string;
  /**
   * Link to upstream details property for Grafana on-call webhook.
   */
  externalUrl?: string;
}
 
curl -X PATCH "https://api.novu.co/v1/subscribers/string/online-status" \
  -H "idempotency-key: string" \
  -H "Authorization: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "isOnline": true
  }'
{
  "_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": 0,
  "data": {},
  "timezone": "string"
}