Star
Packages

@notifkit/provider-fcm

The push transport, over Firebase Cloud Messaging, which reaches Android directly and iOS through APNs.

npm install @notifkit/provider-fcm
import { FcmTransport } from "@notifkit/provider-fcm";

new FcmTransport({
  // The whole service-account JSON as a string, not a path to it.
  serviceAccountJson: process.env.FIREBASE_SERVICE_ACCOUNT!,
});

Options

OptionRequiredNotes
serviceAccountJsonyesThe service-account JSON, stringified. Parsed lazily on the first send.
loggernoFailures are logged at warn with the FCM error code.
limitsnoDefaults to { limit: 1000, windowSeconds: 60 }: a longer window than the email transport's.

The Firebase app is initialised once, lazily, as notifkit, keeping it separate from any app your code initialised in the same process. Since initialisation waits for the first send, an invalid service account shows up as a failed delivery, not a crash at boot.

Which template keys it reads

Template keyLands as
subjectnotification.title
text or bodynotification.body
html or htmlBodydata.htmlBody, for the app to render itself

data also carries taskId and eventId, so a tap handler can report against its message. On Android, critical or high priority becomes android.priority: "high", and everything else is normal. The APNs payload has sound: "default" and badge: 1.