- updateOnlineFlag - Update subscriber online status
Update the subscriber online status by its unique key identifier subscriberId
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.subscribers.properties.updateOnlineFlag({
isOnline: false,
}, "<id>");
console.log(result);
}
run();The standalone function version of this method:
import { NovuCore } from "@novu/api/core.js";
import { subscribersPropertiesUpdateOnlineFlag } from "@novu/api/funcs/subscribersPropertiesUpdateOnlineFlag.js";
// Use `NovuCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const novu = new NovuCore({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const res = await subscribersPropertiesUpdateOnlineFlag(novu, {
isOnline: false,
}, "<id>");
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("subscribersPropertiesUpdateOnlineFlag failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
subscriberId |
string | ✔️ | N/A |
updateSubscriberOnlineFlagRequestDto |
components.UpdateSubscriberOnlineFlagRequestDto | ✔️ | N/A |
idempotencyKey |
string | ➖ | A header for idempotency purposes |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.SubscribersV1ControllerUpdateSubscriberOnlineFlagResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorDto | 414 | application/json |
| errors.ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| errors.ValidationErrorDto | 422 | application/json |
| errors.ErrorDto | 500 | application/json |
| errors.SDKError | 4XX, 5XX | */* |