Mobile Push

This guide describes mobile push configuration via Maestra services. It outlines most common service integration scenarios.

1. Prepare Your Apps to Use Pushes

You will need to:

Add push rendering:

{  
   "data ":{  
      "message":"<message text>",
      "clickUrl":"<link from push body>",
      "imageUrl":"<image link>",
      "payload":"<any additional JSON>",
      "buttons":[  
         {  
            "text":"<button 1 text>",
            "url":"<button 1 link>",
            "uniqueKey":"<button 1 GUID>"
         },
         {  
            "text":"<button 2 text>",
            "url":"<button 2 link>",
            "uniqueKey":"<button 2 GUID>"
         },
         {  
            "text":"<button 3 text>",
            "url":"<button 3 link>",
            "uniqueKey":"<button 3 GUID>"
         }
      ],
      "uniqueKey ":"<message GUID>"
   }
}
  • Push message contents is determined by emailing settings.
  • The message, clickUrl, and uniqueKey fields are always present.
  • The imageUrl field is populated only if the emailing has an image added.
  • The payload field carries any additional JSON supplied with emailing.
  • The buttons array contains emailing buttons (0 to 3).

2. Register Your Installation at Maestra

You will need to start using our unique InstallationId in your app. To do so, add code to query our service once at application startup, storing the results indefinitely.

Request

POST https://api.maestra.io/v3/mobile/register?endpointId={endpointId}
Accept: application/json
POST https://api.mindbox.ru/v3/mobile/register?endpointId={endpointId}
Accept: application/xml

Response

{  
   installationId:"<installation ID (GUID)>",
   hubName:"<hub ID>",
   connectionString:"<AzurePushHub connection string>"
}
<result>
    <installationId>{installation ID (GUID)}</installationId>
    <hubName>{hub ID}</hubName>
    <connectionString>{AzurePushHub connection string}</connectionString>
</result>

Along with the InstallationId, you will receive the Azure connection details: connectionString and hubName. These are required for the following step.

3. Register Your Installation at Azure

Register your installation at Azure using an HTTP request with authorization headers, supplying mandatory data only:

{  
   "installationId":"<InstallationId>",
   "platform":"<gcm for Android, apns for Apple>",
   "pushChannel":"<PSN token>"
}

You'll need a valid PNS token for your request. Obtain it as follows:

4. Send Customer Actions

Provide customer registration events, views of products and categories, cart aсtions, and order processing via the mobile app backend.

5. Send Click-Related Data

To monitor push clicks, transmit push-related data to Maestra. Invoke the following operation when push body or buttons are clicked.

POST https://api.maestra.io/v3/mobile-push/click?endpointId={endpointId}

Content-Type: application/json

{  
   "click":{  
      "messageUniqueKey":"<message GUID>",
      "buttonUniqueKey":"<button GUID>"
   }
}
POST https://api.mindbox.cloud/v3/mobile-push/click?endpointId={endpointId}

Content-Type: application/xml

<operation>
    <click>
        <messageUniqueKey>{message GUID}</messageUniqueKey>
        <buttonUniqueKey>{button GUID}</buttonUniqueKey>
    </click>
</operation>

Values of messageUniqueKey and buttonUniqueKey are included in request body in push sending.

  • The messageUniqueKey field is mandatory.
  • The buttonUniqueKey field is optional and isn't supplied if push body is clicked instead of its buttons.

A correct request yields the HTTP_OK (200) code, and the click is added to customer actions list.