Mesibo Backend APIs - Push Notifications

This section describes how to configure push notification credentials using backend APIs. For in-depth details on how to use mesibo push notifications and configuration using the console, refer to the mesibo push notification documents.

If you are using the mesibo on-premise server, it is highly recommended to use backend APIs to configure push notifications instead of the mesibo console. This ensures complete privacy of your push notification credentials. If you configure push notifications using both the backend API and the console, the on-premise server will give preference to the credentials configured via the backend APIs, which are saved in your database.

If you are using the mesibo cloud service, you can use either the console or the backend APIs.

In addition to credential configuration, the backend push notification APIs allow you to:

  • Configure various push options (e.g., background notifications, sound, rate limiting)
  • Activate debug mode to troubleshoot issues
  • Send test push notifications

Uploading Push Notification Credentials

To configure FCM (Firebase Cloud Messaging) credentials, you need to upload the JSON file downloaded from the Google FCM service account, as described in the mesibo push notification documentation.

To configure APN (Apple Push Notification service) credentials, you need to upload the Apple Push Certificate file in .p12 format without any password, as described in the mesibo push notification documentation. You can upload multiple APN credentials if you have multiple iOS apps under one single mesibo app.

Here's an example HTML form to upload your push credentials (replace with your actual app token). Depending on the file extension (.json for FCM, .p12 for APN), mesibo backend API will configure FCM or APN credentials. However, you can override this behavior by passing an additional form field type with the value fcm or apn.

<form action="https://api.mesibo.com/backend" method="post" enctype="multipart/form-data">
  <input type="file" name="file">
  <input type="text" name="op" value="pushupload">
  <input type="text" name="token" value="<app token>">
  <input type="submit" value="Upload" name="submit">
</form>

If you're using the mesibo on-premise server, change the action URL to your on-premise backend server URL.

Following are the request parameters, most of them are OPTIONAL unless the Default value is mentioned as Mandatory.

ParameterDescriptionDefault
opMUST have the value - "pushupload"Mandatory
tokenApplication Token obtained from the mesibo consoleMandatory
type[Optional] 'fcm' or 'apn' to override FCM or APN configuration based on file extension.empty
fileFile field to upload FCM or APN credentialstrue

Note:

  • For FCM credentials, upload the JSON file downloaded from the Google FCM service account.
  • For APN credentials, upload the Apple Push Certificate file in .p12 format without a password.
  • If you have multiple iOS apps under one mesibo app, you can upload multiple APN credentials.

Configuring Push Options

You can configure various push options by sending a JSON request to the backend API. Here's an example minimal request:

{
    "op": "pushset",
    "token": "ptlk9hdel1gqxf3p0s15f5f5gtusldej18tl794suzit",
    "push": {
        "background": true,
        "collapse": false,
        "sound": false,
        "forceprod": false
    }
}

Following are the request parameters, most of them are OPTIONAL unless the Default value is mentioned as Mandatory.

ParameterDescriptionDefault
opMUST have the value - "pushset" (see example above)Mandatory
tokenApplication Token obtained from the mesibo consoleMandatory
push.backgroundEnable Background Notification (alert otherwise)true
push.fallbackAuto-fallback to alert if the user's device hasn't responded to the background notificationttrue
push.ratelimitRate-limit push notifications to avoid being throttled by Google and Apple push notification serverstrue
push.collapseCollapse Notificationsfalse
push.soundEnable Sound (ios only, when background is false)false
push.forceprodSend Sandbox Push to APN Production server (iOS only, requires production certificate)false
push.iosfcmAutoroute iOS Push through APN or FCM (iOS only)false

Sending Test Push Notifications

You can send test push notifications using the backend APIs to troubleshoot any push issues by sending the following JSON request:

{
    "op": "pushtest",
    "token": "ptlk9hdel1gqxf3p0s15f5f5gtusldej18tl794suzit",
    "push": {
        "address": "123456",
    }
}

Following are the request parameters, most of them are OPTIONAL unless the Default value is mentioned as Mandatory.

ParameterDescriptionDefault
opMUST have the value - "pushset" (see example above)Mandatory
tokenApplication Token obtained from the mesibo consoleMandatory
push.addressAddress of the user to send the push notificationtrue

You can enable push debugging and a webhook for push results to check the push notification results.

Sending test push notifications is rate-limited. There is no such limitation if you're running mesibo on-premise.

Push Debugging

Push debugging allows you to receive debugging information for every push sent to FCM or APN. You should also enable a webhook to receive push results and payload for both successful and failed push notifications, allowing you to view all push results and troubleshoot any issues.

Since push debugging consumes extra resources on the server, you can only enable it for 3 hours once every 8 hours. There is no such limitation if you're running mesibo on-premise.

{
    "op": "pushdebug",
    "token": "ptlk9hdel1gqxf3p0s15f5f5gtusldej18tl794suzit",
    "push": {
        "duration": 1800,
    }
}

Following are the request parameters, most of them are OPTIONAL unless the Default value is mentioned as Mandatory.

ParameterDescriptionDefault
opMUST have the value - "pushset" (see example above)Mandatory
tokenApplication Token obtained from the mesibo consoleMandatory
push.durationDebugging duration in seconds