Batch features rely on a set of RESTful APIs, making any third party integrations easy. Access and export your campaign reports anywhere. Trigger campaigns from the comfort of your back-end. Command multiple apps at once. Possibilities are endless.
With these APIs, push notifications can be sent directly from your backend, your CMS or your app.
The Transactional API is made for 1-to-1 interactions. It allows you to push a specific user ID or a group of IDs (device token, install ID or custom user ID). See here to know more.
Use it to send action-oriented or time-sensitive push notifications.
The Campaigns API is made for 1-to-many interactions. Use it if none of the above examples fit your use case. It allows you to target a large audience or users. See here to know more.
You can use the Campaigns API to send generic/optional notifications. Here are a few examples:
With our Campaigns API, you can connect your CMS to Batch to send push notifications. It gives you the same level of features as Batch's dashboard:
Here is how a basic Campaigns API + CMS setup looks like:
With the Campaigns API you can:
POST- Create or edit an existing push campaign. If the POST to the API endpoint is successfull you will receive an HTTP 201 confirmation with a campaigns token.
GET- Track the results of a campaign using a campaign token. Each time you send a push campaign, Batch also receives feedback from APNS/GCM and cleans the invalid tokens for you.
Please note that Batch manages iOS and Android apps separately. You will need to call our APIs twice if your app has an iOS and an Android version.
Have any questions on a specific Batch+CMS integration? Feel free to ping us at email@example.com.
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 Batch Transactional API and specifying up to 10K user IDs.
As described in the above example, you need to write server-side code to:
A small NodeJS or PHP script can do the job perfectly if you are familiar with those technologies. Here is a sample if you want to know how a working script looks like.
There are three type of user IDs you can use to target your users with the Transactional API:
If you have a messaging app, there are two approaches to send push messages to your users using Batch. You can either call the transactional API from your back-end or from your app.
You can trigger push notifications from your back-end using the transactional API each time a message is sent to a user. All you need to do is to monitor changes in your back-end and trigger the transactional API on certain events (e.g. unread_message=true).
You can also call the transactional API from your app but we discourage it for security reasons. Users with bad intentions may reverse engineer your app, extract the REST API key and push your users on your behalf.
If you still want to push from code though, you will need to use the standard HTTP library of your platform:
NSURLSession on iOS, or
HttpUrlConnection on Android. Here is how a basic integration looks like:
The API is called from User A's device and targets User B's ID each time User A sends a message to user B. You can use our iOS code sample (Swift 2 / Swift 3) if you want to see how this solution works.