Transports

Web Push

Encrypt and send browser notifications with VAPID.

Encrypt and send browser notifications with VAPID.

The one rule

Create this transport under the matching sently channel sender.

Configuration

OptionTypeDefault or requirement
vapidPublicKeystringrequired
vapidPrivateKeystringrequired
subjectstringrequired
allowedEndpointHostsstring[]optional
import { createPushSender } from "sently/push";
import { WebPushTransport } from "sently/transports/webpush";

const sender = createPushSender({ transport: new WebPushTransport({ vapidPublicKey: "...", vapidPrivateKey: "...", subject: "mailto:you@example.com" }) });
await sender.send({ subscription, title: "Hello", body: "World" });

On this page