Node SDK
The same npm package, imported instead of typed.
The CLI package doubles as the SDK — npm install stdpush in a project:
import { push, Stdpush, StdpushError } from "stdpush";
// Uses STDPUSH_API_KEY (or credentials saved by `stdpush login --key`)
await push({
title: "Training complete",
message: "loss 0.041 after 18 epochs",
priority: "normal",
topic: "ml-runs",
});
// Explicit client
const client = new Stdpush({ apiKey: process.env.STDPUSH_API_KEY });
try {
await client.push({
title: "Deploy done",
clickUrl: "https://ci.example.com/42",
});
} catch (err) {
if (err instanceof StdpushError) {
console.error(err.status, err.code, err.message);
}
}The payload mirrors POST /v1/notify: title, message,
topic, priority, clickUrl, metadata, ttlSeconds and
idempotencyKey are all supported. Errors throw a typed StdpushError
with status and code — the SDK never calls process.exit.