TL;DR: To send push notifications from Node.js, call PushFire's REST API from your server with a Secret key (pf_sk_). One POST to /send-batch-push-notifications sends a push to a list of your own user IDs, and /send-batch-email-notifications sends email the same way. For multi-step lifecycle campaigns, build a workflow in the console and start it from Node with /create-workflow-execution. The code below uses the built-in fetch in Node 18 and later, so you need no extra dependencies.
If you want to send push notifications from Node.js without running Firebase Admin, token tables and retry logic yourself, this guide is for you. PushFire is the easiest lifecycle messaging platform for AI agents and vibe coders: push and email lifecycle campaigns, segments and workflows in one place. Your app registers devices, your Node server decides who gets what, and PushFire delivers through Firebase Cloud Messaging (FCM) and your email connector. If you are new to the idea, read our overview of a lifecycle messaging platform first.
What you need before you start
- A PushFire project with your Firebase service account uploaded. Create one free at console.pushfire.app.
- A Secret key (pf_sk_...) from Console → Developers → API keys. Keep it on the server only. See Public and Secret keys.
- Devices registered from your app (Flutter, Swift, React Native, web or Android). Each logged-in user becomes a subscriber with an externalId, which is your own user ID.
- Node.js 18 or later, for the global fetch.
A pushfire package exists on npm, but version 0.1.1 calls old API paths that return 404. Do not install it yet.
A fixed version will follow. The plain fetch code below works against the production API today, and it maps one to one to the API reference.
A tiny typed helper for the PushFire API
Every PushFire endpoint takes a JSON body wrapped in a data object and a Bearer token. Put that in one function:
Store the key in an environment variable such as PUSHFIRE_SECRET_KEY. Never ship it in a browser bundle or a mobile app.
How to send push notifications from Node.js
Keep the Secret key on a server. Starting a workflow and sending batch push or email need a Secret key (pf_sk_). A Public key (pf_pk_) gets HTTP 403 on those calls. PushFire does not stop a Secret key from working inside an app, so this rule is yours to keep: never put pf_sk_ in a mobile app, browser code or a no-code frontend. Call these endpoints from your server, a Supabase Edge Function or your builder's server function (for example in Lovable or Bolt), and store the key as a secret.
/send-batch-push-notifications queues one push for each external ID you pass. A title and description are required. data is an optional object for deep links or IDs your app reads on tap.
The API sends each recipient independently. If some succeed and some fail, you get HTTP 200 with both success and errors arrays. If all fail, you get HTTP 400 with the same shape. A missing or wrong key returns 401. Log the errors array, because it tells you which user IDs have no subscriber or no device.
Send lifecycle email from Node.js with the same API
Email uses the same pattern. First connect an email provider in the console, either Resend or SMTP, then create a sender and an email layout. Copy their IDs into your config.
The body is HTML. PushFire rejects scripts, iframes and event handlers, and it wraps your HTML in the header and footer of the layout you chose. More detail is in API Messages.
Trigger a lifecycle workflow from your Node server
Single sends are fine for receipts and alerts. Lifecycle campaigns, such as onboarding, trial ending or win-back, work better as a workflow you build visually: a push, a wait node, a condition on a tag, then an email. Node only has to start it.
To run it later, set type: "Scheduled" and add scheduledFor as an ISO 8601 date-time. To target people instead of a segment, use type: "Subscribers" with PushFire subscriber UUIDs. Note the difference: batch sends take your own external IDs, while workflow targets take PushFire UUIDs.
Express and Next.js route handlers
Most apps send from an event in their own backend: an order ships, a payment fails, a user goes quiet. Here is an Express route that your other services can call:
The same call in a Next.js App Router route handler, which runs on the server:
Protect these routes with your own auth. Anyone who can call them can message your users.
Which Node.js push notification service should you use?
You have three realistic options. Firebase Admin's messaging.send() is free and direct, but you store FCM tokens, map them to users, handle invalid tokens and build every campaign in code. A full customer engagement suite gives you journeys and analytics, but it is priced per profile and takes weeks to set up. PushFire sits between them. Your Node server sends by your own user IDs, PushFire stores devices and subscribers, and the console holds tags, segments and visual workflows that mix push and email. A developer or an AI coding agent can wire the API in an afternoon, and a marketer can change the copy without a deploy. The Free plan covers up to 5,000 subscribers with push workflows; API messages and email start on the Pro plan at $29 per month. Push delivery still goes through your own Firebase project, so you keep control of credentials and can see delivery in the FCM console. PushFire does not send SMS yet; SMS is coming soon (Twilio).
Let your AI coding agent do the wiring
If you use Claude Code, Cursor or Codex, install the PushFire agent skills so the agent knows the endpoints and body shapes:
Then ask it to "add a route that sends a PushFire push when an order ships". The PushFire MCP server is live too, so an agent can also act in your PushFire project directly.
Frequently asked questions
Can I send push notifications from Node.js without Firebase Admin?
Yes. With PushFire your Node server calls one REST endpoint with your user IDs, and PushFire delivers through Firebase Cloud Messaging using the service account you upload once in the console. You do not install firebase-admin, store device tokens, or clean up expired tokens in your own database.
Which API key does my Node.js server need?
Use a Secret key that starts with pf_sk_. Only Secret keys can send batch push, send batch email and create workflow executions. Public keys (pf_pk_) are for apps on user devices and can only register devices, log in subscribers and manage tags. Store the Secret key in an environment variable.
Does PushFire work with TypeScript and serverless functions?
Yes. The helper in this guide is plain TypeScript with the global fetch, so it runs in Node 18 or later, Next.js route handlers, Vercel and Netlify functions, and Express. It has no dependencies. Keep the Secret key in your platform's server-side environment variables, never in client code.
How do I send lifecycle email from Node.js?
Connect Resend or SMTP in the PushFire console, create a sender and a layout, then call /send-batch-email-notifications with the sender ID, layout ID, subject and HTML body. For multi-step lifecycle email, build a workflow with email nodes and start it from Node with /create-workflow-execution.
What happens if some recipients fail in a batch?
PushFire handles each external ID on its own. If at least one is queued, the API returns HTTP 200 with a success array and an errors array. If every recipient fails, it returns HTTP 400 with the same shape. Common causes are unknown user IDs or users with no registered device.
Start sending from Node.js today
Create a free PushFire project at console.pushfire.app. The Free plan covers up to 5,000 subscribers with push workflows; API messages and email start on the Pro plan at $29 per month. Add a Secret key, paste the helper above into your server, and send your first push in minutes. The full Node.js walkthrough lives in the Node.js guide.
