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
| Name | Type | Description |
|---|---|---|
| action | Array | Array of actions that are relevant to the user. |
| action.name | String | Action name, defines on MXO. |
| action.asset | Object | Asset assigned to this action, and matching the configuration in MXO. |
| action.asset.content | Object | Content of the asset. |
| action.asset.mime.type | String | Data mime type for the asset. Assumed to be application/json in our example. |
| action.asset.contentUrl | String | Link to the URL where the asset content is hosted. |
| action.asset.responses | Array | Response 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.label | String | Response labels configured for the asset. |
| action.asset.responses.target | String | Location where the target URl for the response should open. Either external or in_app. |
| action.asset.responses.sentiment | String | Response sentiment. Either positive, neutral, or negative. |
| action.asset.responses.imageUrl | String | Response image URL. Not used in this example. |
| action.asset.responses.code | String | Response code. The unique response code to send back to MXO to record the specific sentiment. |
| action.asset.responses.targetUrl | String | Response target URL. The mini-notification target URL. |
