Notifications

Notifications: the email alerts NoClick sends your account's owner, one switch for each kind.

class Notifications

Which kinds of email alert NoClick sends your account's owner: categories maps each kind (run_failure, credits, spend_cap, digest, ...) to whether it's on. A kind never turned off is on. They're what Settings → Notifications in the NoClick app shows, and every alert email carries a one-click link that turns its own kind off.

Attributes
categoriesRecord<string, boolean>
rawJsonObject

The response JSON exactly as the API sent it.

Types
type JsonObject = { [key: string]: unknown };

getstatic

static get(options?: { client?: NoClick }): Promise<Notifications>

Read which kinds of email alert your account's owner gets. Any of your account's own keys may, but one held to one of your users, which rejects with PermissionDenied: they're the owner's.

const alerts = await Notifications.get();
console.log(alerts.categories.digest); // true until it's turned off
Parameters
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

Every kind NoClick sends, each True (on) or False (off).

updatestatic

static update(
  categories: Record<string, boolean>,
  options?: { client?: NoClick },
): Promise<Notifications>

Turn kinds of email alert to your account's owner on (true) or off (false), in one change; a kind you leave out stays as it is. A kind NoClick doesn't send, or a value that isn't true or false, rejects with InvalidRequest and changes nothing. Resolves to every kind, as it stands after the change.

await Notifications.update({ digest: false, run_failure: true });
Parameters
categoriesRecord<string, boolean>required
options.clientNoClick

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

Returns

Every kind, as it stands after the change.