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. |