Event-based notifications allow you to reach specific users each time an event is triggered in your back-end. You can send these notifications using the Transactional API and targeting up to 10K IDs per call.

As described in the above example, you need to write server-side code to:

  1. Monitor changes in your back-end or your Firebase database.

  2. Trigger a call to the Transactional API targeting one or several IDs.

A small NodeJS or PHP script can do the job perfectly if you are familiar with those technologies.

There are four types of IDs you can target with the Transactional API:

  • Custom user ID: If your app has a login system, Batch can associate several push tokens to a single user ID. This allows you to use the Transactional API with your own IDs, regardless of the OS of the user (know more here: iOS / Android / Cordova / Web).

  • Installation ID: In case your app doesn't have a login system or you don't want to share your user IDs with Batch, you can use the Installation ID. This anonymized ID is generated automatically by Batch and offers the same advantages as with custom IDs (know more here).

  • Advertising ID (IDFA/GAID): If your app doesn't have a login system and you are collecting the advertising ID of your users.

  • Device token: We recommend against using push tokens with the transactional API. Push tokens are linked to a specific device and OS. They also change on Android and iOS when users reinstall your app.

Batch provides a simple debug tool that lets the list of all the targeted push tokens for any given API call to the Transactional API. Go to ⚙️ Settings → Debug, select "Transactional" and input the token generated by the API on each successful call:

🚧 Important note : Batch manages iOS and Android separately. You will need to call our APIs twice if your app has an iOS and an Android version.

Did this answer your question?