npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pushpal

v1.0.0

Published

Cross-platform mobile notifications for Node.js via Telegram Bot, Bark and Ntfy.

Downloads

263

Readme

pushpal

Cross-platform mobile notifications for Node.js via Telegram Bot, Bark and Ntfy.

Zero runtime dependencies. One simple API. Multiple mobile notification channels.

中文:pushpal 是一个 Node-first 的轻量级 JavaScript 通知 SDK,用统一 API 向 Telegram Bot、Bark 和 Ntfy 发送移动端通知。

Install

npm install pushpal

Requirements:

  • Node.js >= 18
  • ESM or CommonJS
  • No runtime dependencies

Quick Start

import { PushPal } from "pushpal";

const client = new PushPal();

const results = await client.ntfy(
  { topic: "my-alerts" },
  {
    title: "Deploy complete",
    body: "v0.3 is live",
  },
);

console.log(results);

Channels

Telegram Bot

await client.telegram(
  { token: "BOT_TOKEN", chatId: "123456" },
  {
    title: "Server alert",
    body: "CPU usage is above 90%",
    url: "https://example.com/runbook",
    buttonText: "View runbook",
  },
);

Bark

await client.bark(
  { deviceKey: "YOUR_DEVICE_KEY" },
  {
    title: "Reminder",
    body: "Drink water",
    level: "timeSensitive",
    sound: "minuet",
  },
);

For a private Bark server:

await client.bark(
  { serverUrl: "https://bark.example.com", deviceKey: "YOUR_DEVICE_KEY" },
  { title: "Hello", body: "From pushpal" },
);

Ntfy

await client.ntfy(
  { topic: "ops-alerts" },
  {
    title: "Deploy complete",
    body: "v0.3 is live",
    priority: 4,
    tags: ["white_check_mark"],
  },
);

With private Ntfy auth:

await client.ntfy(
  {
    serverUrl: "https://ntfy.example.com",
    topic: "ops",
    auth: { type: "bearer", token: "tk_xxxxxxxx" },
  },
  { title: "Alert", body: "Disk space is low" },
);

Group Broadcast

Group sends the common message fields (title, body, url) to every configured channel.

await client.group(
  {
    telegram: { token: "BOT_TOKEN", chatId: "123456" },
    bark: { deviceKey: "YOUR_DEVICE_KEY" },
    ntfy: { topic: "ops-alerts" },
  },
  {
    title: "Incident",
    body: "Production database connection failed",
    url: "https://monitor.example.com",
  },
);

Retry And Timeout

Configure retry and timeout globally:

const client = new PushPal({
  retry: 2,
  timeout: 5000,
});

Override them per message:

await client.ntfy(
  { topic: "ops-alerts" },
  {
    title: "Alert",
    body: "Retry this send",
    retry: 3,
    timeout: 2000,
  },
);
  • retry is the number of retry attempts after the first failed request.
  • timeout is measured in milliseconds.
  • Network and timeout failures are returned as SendResult failures instead of being thrown.

SendResult

All send methods return Promise<SendResult[]>.

interface SendResult {
  channel: "telegram" | "bark" | "ntfy";
  target: string;
  ok: boolean;
  status?: number;
  data?: unknown;
  error?: string;
}

Target values are safe for logs:

  • Telegram tokens are never returned.
  • Bark device keys are masked, for example bark:key:abcd...wxyz.
  • Ntfy auth credentials are never returned.

Error Handling

Input errors throw TypeError before sending:

  • Missing title or invalid body
  • Missing Telegram token or chatId
  • Missing Bark deviceKey
  • Missing Ntfy topic
  • Invalid retry or timeout

Send errors return SendResult objects with ok: false:

  • Network failures
  • Timeout failures
  • HTTP non-2xx responses
  • Response parsing failures

Browser Security

Do not expose Telegram Bot tokens, Bark device keys, or private Ntfy credentials in browser code.

For browser apps, send notifications through your own backend proxy unless the target topic is intentionally public.

中文提示:不要在前端代码中暴露 Telegram Bot Token、Bark Device Key 或私有 Ntfy 鉴权信息。浏览器应用应通过后端代理发送通知,除非目标 topic 明确是公开的。

Examples

Runnable offline examples are in examples/.

npm run build
node examples/node-esm.mjs
node examples/node-cjs.cjs
node examples/telegram.mjs
node examples/bark.mjs
node examples/ntfy.mjs
node examples/group.mjs
node examples/retry-timeout.mjs

The examples use mock fetch functions so they do not send real notifications.

中文用法速览

import { PushPal } from "pushpal";

const client = new PushPal({
  retry: 2,
  timeout: 5000,
});

await client.group(
  {
    telegram: { token: "BOT_TOKEN", chatId: "123456" },
    bark: { deviceKey: "YOUR_DEVICE_KEY" },
    ntfy: { topic: "ops-alerts" },
  },
  {
    title: "紧急通知",
    body: "生产数据库连接失败,请立即处理",
    url: "https://monitor.example.com",
  },
);

License

MIT