Understand Decoded Optimization Data Objects

After the optimization data has been base64 decoded, you will end up with a JSON payload similar to the one below. Please refer to the sample app code to understand how this can be achieved in your app.

top-banner Decoded JSON Response

{
   "actions":[
      {
         "name":"Product 1B - top banner",
         "asset":{
            "content":"{ \"image\": \"https://raw.githubusercontent.com/thunderheadone/one-sdk-android/master/examples/optimizing-programmatically-using-json-example/app/src/main/assets/product_1b.png"}",
            "mimeType":"application/json",
            "contentUrl":null,
            "responses":[
               {
                  "code":"dGlkPWFjZjk5ZjgyLWQ4ZmItZjJiYy0zYzNhLWQ3NmE0MzgwNGI3MCxhYz0xMjQyNDYxMDMsY250PTEyNTEwNTc1MixvcD0xMTMzNzM3ODQscnQ9UE9TSVRJVkVfQ0xJQ0ssc2s9T05FLURaODdZWEQ5OEYtOTQwNQ",
                  "sentiment":"positive",
                  "label":null,
                  "imageUrl":null,
                  "targetUrl":null,
                  "target":null
               }
            ]
         },
         "proposition":{
            "code":""
         }
      }
   ]
}

card-item Decoded JSON Response

{
   "actions":[
      {
         "name":"Product 2B - card item",
         "asset":{
            "content":"{ \"image\": \"https://raw.githubusercontent.com/thunderheadone/one-sdk-android/master/examples/optimizing-programmatically-using-json-example/app/src/main/assets/product_2b.png"}",
            "mimeType":"application/json",
            "contentUrl":null,
            "responses":[
               {
                  "code":"dGlkPWFjZjk5ZjgyLWQ4ZmItZjJiYy0zYzNhLWQ3NmE0MzgwNGI3MCxhYz0xMjQyNDYxMDQsY250PTEyNTEwNTc1NCxvcD0xMTMzNzM3ODUscnQ9UE9TSVRJVkVfQ0xJQ0ssc2s9T05FLURaODdZWEQ5OEYtOTQwNQ",
                  "sentiment":"positive",
                  "label":null,
                  "imageUrl":null,
                  "targetUrl":null,
                  "target":null
               }
            ]
         },
         "proposition":{
            "code":""
         }
      }
   ]
}

JSON Response Parameters

The decoded optimization data response contains the following elements:

  • actions – an array of Actions.
    • name – the name of the Action as defined in MXO.
    • asset – the Asset selected by the Action.
      • content – the Asset content as defined in MXO.
      • responses – Positive, Negative and/or Neutral. For more information about responses, see What are Customer Responses? and Understanding Asset Responses
      • code – the code sent to MXO when the user taps on the content.
      • sentiment – typically "positive".

Response Elements

NameTypeDescription
actionArrayArray of Actions that are relevant to the user.
action.nameStringAction name, defines on MXO
action.assetObjectAsset assigned to this Action, and matching the configuration in MXO
action.asset.contentObjectContent of the Asset.
action.asset.mime.typeStringData mime type for the Asset. Assumed to be application/json in our example.
action.asset.contentUrlStringLink to the URL where the Asset content is hosted.
action.asset.responsesArrayResponse array associated with the Asset. Contains a list of all the responses that can be sent back for an Asset to record the user sentiment.
action.asset.responses.labelStringResponse labels configured for the Asset.
action.asset.responses.targetStringLocation where the target URl for the response should open. Either external or in_app.
action.asset.responses.sentimentStringResponse sentiment. Either Positive, Neutral, or Negative.
action.asset.responses.imageUrlStringResponse image URL. Not used in this example.
action.asset.responses.codeStringResponse code. The unique response code to send back to MXO to record the specific sentiment.
action.asset.responses.targetUrlStringResponse target URL. The mini-notification target URL.