Skip to content
All articles

Transactional Push: A User ID Is Not a Device Token

A valid push token can still belong to the wrong session. Map user identity, logout, app scope, and retries before sending transactional push with PushPilot.

Transactional Push: A User ID Is Not a Device Token

A successful send to the wrong signed-in person is not a delivery success. Transactional push begins with identity: which account owns the event, which installations currently belong to that account, and which application is allowed to receive it? Device tokens answer a transport question. User IDs answer a product question. PushPilot supports both forms of targeting, but the application must keep their relationship accurate.

Separate the three identities in the flow

Your application user ID identifies an account in your own system. A PushPilot installation identifies an installed app or browser instance. The push address tells the transport where to send. These values have different lifetimes. A person can use multiple installations, a shared device can change accounts, and a transport token can change without the person becoming a new customer.

An illustrative order confirmation belongs to user customer_42 and order order_917. The backend should resolve the notification from that account relationship, not from whichever token happened to be stored when the order began. Use a stable internal user identifier rather than a display name that can change. Avoid placing sensitive transaction details on a lock screen merely because the target is specific.

IdentifierRepresentsCommon mistake
External user IDAccount in your applicationUsing a changeable display name
Installation IDOne installed instanceTreating it as a person
Push addressTransport destinationAssuming it never changes
Idempotency keyOne send intentGenerating a new one on every retry

Treat logout as part of notification integration

The PushPilot SDK integration links a device to your external user ID after login and clears that relationship on logout. This is not a replacement for application authentication. Your own session system determines which account is signed in; the notification integration reflects that decision. Test account switching as carefully as first registration.

Use an illustrative shared tablet test: sign in as one test user, receive a user-targeted message, sign out, then sign in as another. Verify that subsequent messages target the new relationship correctly. Also test a person signed in on two devices. A user-targeted send can reach multiple eligible installations, which is different from one visible notification per human.

Choose user targeting for private transactional context

PushPilot ordinary notifications support targeting external user IDs, installation IDs, topics, all eligible devices, and supported saved segments. Choose the narrowest target that expresses the transaction. An installation target is useful for a controlled device test. An external user target expresses “this account” without requiring your business service to select a particular phone.

Firebase’s topic guidance describes topics as suitable for publicly available information and throughput-oriented fanout. A topic name is not an authorization boundary for private account data. Keep sensitive details behind the application’s authenticated destination, and make the notification itself a minimal useful prompt. The same identity discipline matters whether the broader stack uses Firebase FCM, OneSignal, Braze, or PushPilot.

Keep sending authority on the server

The public SDK key belongs in the client integration. It identifies the app platform and is different from a server API key with sending authority. Use the backend for transactional sends, with the server key kept outside mobile bundles and web pages. Scope the API key to the relevant apps where appropriate, then explicitly check that the intended target and app scope agree.

PushPilot exposes a notification API and a dashboard composer. Use the current notification documentation for the request contract rather than copying an old device-registration example from a blog. A successful API request creates a send to be processed. Keep the returned identifier so the application can inspect its status and connect the messaging record to the original business event.

Reuse an idempotency key for the same event

Network failures create ambiguity: the caller may time out after the server accepted the request. PushPilot’s notification API requires an Idempotency-Key. Within the current 24-hour replay window, the same key and same request body return the original send; reusing that key with a different body produces a conflict. Retrying with a new key would instead express a new request.

Derive a stable key from your event identity and notification purpose, then persist it with the job. Keep the payload stable across retries. This reduces duplicate creation for that event, but it is not a permanent deduplication guarantee beyond the documented window. Your application still needs a durable record of processed business events and a deliberate policy for delayed retries.

Measure the result at the right layer

Firebase documents that a returned message ID means acceptance for delivery, not arrival on the device. The difference matters for receipts, account alerts, and operational updates. Separate request creation, provider acceptance, reported receipt or interaction, and the business outcome. Do not claim a customer read a transaction because the transport accepted it.

Test foreground, background, closed-app, logout, account switching, token refresh, and a duplicate backend event. Verify the deep link opens the intended record only after the app’s usual authorization checks. Transactional messaging rarely benefits from speculative urgency or AI-invented details. Use AI to help draft a clear template if useful, while the authoritative event, identity, and retry rules stay deterministic.

Frequently asked questions

Does one user ID mean one notification on one phone?

No. One external user can have multiple eligible installations. Decide whether reaching all of those devices is appropriate for the event.

What should happen at logout?

Clear the user association through the SDK logout flow. Test shared-device account switching so private notifications do not follow an obsolete session relationship.

Is the public SDK key a server sending key?

No. Public SDK keys identify app platforms. Server API keys authorize backend operations and must not be included in client bundles or pages.

Does idempotency last forever?

No. The current notification API replays matching requests within 24 hours. Keep your own event-processing record for business-level deduplication beyond that window.

Sources and next steps

Platform requirements and product instructions:

Keep exploring.

Developer Guide

Push SDK Integration: Test the Second Session Too

5 min read
Getting Started

Your First Week With PushPilot: One Useful Journey First

5 min read
Development

Push Notification MCP: Turn an AI Request Into Reviewable Work

5 min read
Transactional Push: A User ID Is Not a Device Token | PushPilot Blog