Skip to content
Preview: the PushFleet API isn't live yet. Join the waitlist

Quickstart

This guide uses your test environment, so nothing reaches real users and you don’t need a user token yet.

In the dashboard, create a project for your app. It comes with a test and a live environment, and each has a publishable key for your app and a secret key for your server.

Upload your Apple .p8 key and your Firebase service account. PushFleet checks both by minting a real token, so you know right away if something’s wrong. Apple and Android show where to find them.

Call register from your app once the operating system gives you a push token. Use your test publishable key and your own ID for the signed-in user.

PushFleet.configure(publishableKey: "pf_pub_test_…")
PushFleet.register(deviceToken: token, userId: "user_8f3k")

In live mode the app also passes a user token your server signed. See identity verification.

Send from your server with your test secret key. You address a user, not a device; PushFleet delivers to every device they’ve registered.

import { PushFleet } from "pushfleet";

const fleet = new PushFleet(process.env.PUSHFLEET_SECRET_KEY);
await fleet.send({
  to: "user_8f3k",
  title: "Your order shipped",
  body: "Arriving Thursday",
});

The API answers 202 with the message’s ID right away, and delivery happens in the background:

{"id":"msg_2Xk9fQ","status":"queued"}

Look the message up later to see its status on each device, or watch it arrive in the dashboard’s delivery log.