Skip to main content
Brudcast can only notify a device it knows about. Your app gets a registration token from the Firebase SDK, and your backend registers that token against the contact who uses the device. The call comes from your backend because it needs your organization’s API key, which must never ship inside an app.
Before you start, you need:
  • An app in Channels > Push that isn’t disabled. See Connect Firebase.
  • A platform API key with the contacts:write scope, kept on your server. Listing apps also needs senders:read. See API keys.
  • The contact who uses the device, already in Brudcast.

Find your app’s ID

Every registration names the app the token was issued for. List your apps to get its id. The identifier field is the Firebase project ID.

Register a device

POST /contacts/{contactId}/push-notifications
string
required
The contact who uses the device.
string
required
The app the token was issued for. It must belong to your organization and must not be disabled.
string
required
The Firebase registration token. Up to 4,096 characters.
string
required
android, ios or web.
string
Your app’s version, for your own records.
object
Any JSON object that describes the device, such as its model or operating system version.
boolean
Marks this as the contact’s primary device. Other devices keep their flag, so more than one can be primary.
The response is 201, whether the device is new or already known.
Keep the device id. You need it to update or remove the device, and the push.token_invalidated webhook names devices by it.

Registering again is safe

Brudcast keeps one record per token per app. Registering a token that the app already knows updates that record instead of adding a second one.
  • If the token belonged to another contact, it moves to this one. This covers a shared device, or one user signing out and another signing in.
  • The device becomes active again, and any earlier opt-out or expiry is cleared.
  • appVersion, deviceInfo and isPrimary keep their earlier values unless you send new ones.
So register the device every time a user signs in, and whenever Firebase gives your app a new token. The token on an existing record can’t be edited, so when Firebase issues a new token, register the new one and remove or deactivate the old record.
Registering reactivates a device. Don’t register a device whose user turned notifications off in your app. Mark it inactive instead, and register it again only when they turn notifications back on.

Register devices when you create a contact

POST /contacts also accepts devices, in a pushNotifications array alongside the contact’s other fields. Each entry takes the same fields as a single registration, including the required pushApplicationId. The same one-record-per-token rule and the same subscribers quota apply.

The subscribers quota

A subscriber is a contact with at least one active device. Push plans cap how many subscribers your organization can have, and the free plan allows 1,000.
  • A contact counts once, however many devices it has.
  • Registering a device for a contact that already has an active device never counts against the cap.
  • Inactive and expired devices don’t count, so a contact whose devices have all expired or opted out frees its place.
  • Without a push plan, registration still works up to the free plan’s 1,000 subscribers, so your app can start collecting tokens before you buy push.
When a registration would take you past the cap, the call fails with status 400 and code QUOTA_EXCEEDED, and the device isn’t saved. Upgrade your push plan in Billing & Plans, or remove devices you no longer need.

When a user turns notifications off

When a user switches notifications off in your app, mark the device inactive. Brudcast records when in optedOutAt and stops sending to that device.
Set status back to active when they turn notifications on again. That clears optedOutAt. Brudcast can’t see a permission the user revokes in the device’s own settings. Check the permission when your app opens, and mark the device inactive if it’s gone. To remove a device completely, for example when the user signs out, send DELETE /contacts/{contactId}/push-notifications/{id}.

Expired tokens

Tokens stop working when the app is uninstalled, when its data is cleared, or when Firebase replaces the token. When Firebase rejects a token as unregistered, invalid, or issued by a different Firebase project, Brudcast expires the device automatically.
  • status becomes expired.
  • invalidatedAt records when, and lastFailureReason holds Firebase’s reason. The contact’s page shows the device as invalidated, with the reason.
  • Later campaigns skip the device, and it stops counting as a subscriber.
You don’t need to clean anything up. If the same token is registered again, the device becomes active again.

The push.token_invalidated webhook

To hear about each expiry, for example to delete the token from your own database, subscribe a webhook endpoint to push.token_invalidated under Developers > Webhooks. The event fires once per device, when Brudcast expires it.
The event doesn’t carry the token itself. Match on tokenId. See Webhook event types.

Errors

Connect Firebase

Create the Firebase service account key and add your app.

Write the notification

Send to the devices you’ve registered.

Sync contacts from your app

Create and update contacts from your backend.

Push troubleshooting

Invalid tokens and campaigns that reach no one.