Quick start

Push

Send a Web Push or FCM notification through a channel sender.

Send a browser Web Push or FCM device notification through createPushSender.

The one rule

Use subscription with WebPushTransport, or token with FcmTransport — not both shapes on the wrong transport.

Quick start

import { createPushSender } from "sently/push";
import { WebPushTransport } from "sently/transports/webpush";

const push = createPushSender({
  transport: new WebPushTransport({
    vapidPublicKey: process.env.VAPID_PUBLIC_KEY!,
    vapidPrivateKey: process.env.VAPID_PRIVATE_KEY!,
    subject: "mailto:you@example.com",
  }),
});
await push.send({
  subscription,
  title: "Update",
  body: "Your report is ready.",
});

For FCM device tokens, use FcmTransport and token instead of subscription — see FCM.

Next

On this page