Creating a Google Project for Mobile Push Notifications

To set up mobile push notifications, you need a Google Firebase account. You can create a new Firebase account or use an existing one. Next, you’ll need to generate a private JSON key and upload it to our system. See below for a step-by-step guide.

Step 1. Create a Project in Google Firebase

If you already have a project, skip steps 1-2 and go to step 3.

  1. Go to the Google Firebase service page and click the Get Started button.
Create a Project in Google Firebase
  1. Click the New Project button.
Creating Project
  1. In the dialog window, type a name for the new project and select the checkbox to accept the terms of the security agreement.
Add a project

Checkbox

  1. After the project was created go to the left pane menu. Next to the Project Overview, click the Gear icon item and select Project Settings option in the drop-down list.
Project Settings
  1. In the Service Accounts tab, click the _Create Private Key _button.
Service Accounts Generate key
  1. Next, click the Create Key button in the dialog window to generate the key.
Create Key
  1. To upload the key to our CDP, return to the Settings page of the new Mobile Push project and click the Upload JSON button.
Upload JSON
  1. The functionality of sending mobile push notifications became available.

  2. Enter a name for the new Mobile Push project. The name will be visible in the list of contacts and groups. In the list of groups the number of contacts that have tokens of this application is shown as a separate digit.

New contacts

Step 2: Integrate Firebase with Your Mobile App

This step is for your app developers who need to make additional settings for the launch of mobile push notifications:

Step 3: Upload Your Mobile Token Base via Public API Methods

In the channel body, the parameter device is supported for the above methods, and contains the following fields:

  • appId - app ID (UUID) that is assigned when you register an app in the system. You can find it in the settings. If you register only one app, it is not necessary to pass this field in the request.
  • deviceModel - device model (optional value - up to 50 characters).
  • os - operating system of the device (optional value - up to 50 characters).
  • locale - locale (for example, en_UK, en_US, es_ES).
  • clientVersion - SDK version used in the app (native or esputnik-1). native - for Notification Type push notifications; esputnik-1 - for Data Type push notofications (default).
  • appVersion - mobile app version.
  • active - token activity status.

JSON sample for channel:

{
  "contacts": [
    {
      "channels": [
        {
          "type": "mobilepush",
          "value": "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
          "device": {
            "appId": "123e4567-e89b-12d3-a456-426655440000",
            "deviceModel": "iPhone SE 2nd Gen",
            "os": "iOs",
            "locale": "ru_UA",
            "clientVersion": "native",
            "appVersion": "3.14",
            "active": true
          }
        },
        {
          "type": "sms",
          "value": "380501234567"
        }
      ]
    }
  ],
  "dedupeOn": "sms",
  "contactFields": ["mobilepush", "sms"],
  "groupNames": ["mobile push contacts"],
  "restoreDeleted": true
}

📘

Important

For messages like Notifications, in order to transfer an image, you need to specify the link in the message editor in Custom data in JSON format:
{"es_notification_image":"https://example.com/img.png"}

Additional settings

📘

Important

To collect and track activity on each message in your mobile app, you need to implement a status return. Return to the system the status DELIVERED or OPENED if the mob push is opened. To do this, use the API method: Update interaction status

In the request body, apart from interactionId, you also pass FCM token and the time of the change of status on the device.

Example:

{
    "token": "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1...",
    "status": "OPENED",
    "time": "2020-07-09T15:11:17"
}

To track the click rate of a link (if present) in a mobile push notification and get it available for analytics in a personal profile, your developers need to support this feature in your app. In the message editor, you can add a link to the message body without being able to analyze its click rate.

Link example

When adding a link, two more fields - es_link_raw and es_link - will be passed in the push notification body:

  • es_link_raw - http://example.com/somelink.html - contains the original link that can be opened in the device’s browser or can be an internal link, directing to other app sections;
  • es_link - https://hh.esclick.me/37NdHw333DjRcukc0l - created based on the added link and contains a wrapped link used for click tracking.

📘

Important

For your mobile app, use the data from the field es_link_raw to redirect the user to the app section or to the web resource; use a GET request by the link in es_link to track clicks.

In the editor, you can use a user link format; it can be a link to a web resource, a deep link or dynamic content, for which data is taken from an event (may be applicable for triggered messages).