Sending Properties to MXO

Besides sending programmatic Interactions with Properties to Medallia Experience Orchestration, you can also send defined programmatic Properties to a base Touchpoint or a preconfigured Interaction path.

Tip: When sending Properties to a programmatic Interactions, ensure the Interaction is a fully qualified URI, containing the scheme, authority, and path. For example: android://touchpoint/interaction.

Defining Properties

Define Properties you want to send to Medallia Experience Orchestration as array of Strings, in the form of key/value pairs as shown bellow.

val myProperties = mapOf("keyA" to "valueA", "keyB" to "valueB")
final Map<String, String> myProperties = new HashMap<>();
        myProperties.put("keyA","valueA");
        myProperties.put("keyB","valueB");

After the Properties are defined, they can be sent to Medallia Experience Orchestration by calling the SDK's public methods from the below sections.

Sending Properties to a base Touchpoint

To send Properties to a base Touchpoint, call the mxoSendProperties Kotlin top-level function in a Coroutine or the MedalliaMXO.sendInteraction Java method passing an array of defined Properties, as shown below:

import com.medallia.mxo.mxoSendProperties

scope.launch {
	mxoSendProperties {
        	properties = myProperties
    	}
}
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.interactions.MXOInteraction;
import com.medallia.mxo.interactions.MXOInteractionRequest;
import java.net.URI;

final MXOInteractionRequest sendPropertiesRequest = new MXOInteractionRequest.Builder()
	.interaction(new MXOInteraction(URI.create("/")))
	.properties(myProperties)
	.build();
try {
	MedalliaMXO.sendProperties(sendPropertiesRequest);
} catch (Exception e) {
      e.printStackTrace();
}

To capture errors, set the throwErrors parameter to true and wrap the method in a try/catch block, as shown below:

import android.content.ContentValues.TAG
import android.util.Log
import com.medallia.mxo.MXOErrorApi
import com.medallia.mxo.MXOErrorSdk
import com.medallia.mxo.interactions.MXOInteraction
import com.medallia.mxo.mxoSendProperties
import java.net.URI

scope.launch {
	try {
        	mxoSendProperties(throwErrors = true) {
            		interaction = MXOInteraction(URI("/"))
            		properties = myProperties
		}
        } catch (error: MXOErrorSdk) {
        	Log.e(TAG, "SDK Error: ${error.errorMessage}")
    	} catch (error: MXOErrorApi) {
        	Log.e(TAG, "Api Error: ${error.errorMessage}")
    	}
}
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.interactions.MXOInteraction;
import com.medallia.mxo.interactions.MXOInteractionRequest;
import com.medallia.mxo.MXOErrorApi;
import com.medallia.mxo.MXOErrorSdk;
import java.net.URI;

final MXOInteractionRequest sendPropertiesRequest = new MXOInteractionRequest.Builder()
        .interaction(new MXOInteraction(URI.create("/")))
        .properties(myProperties)
        .build();
try {
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        	MedalliaMXO.sendProperties(true, sendPropertiesRequest);
    	} else {
        	MedalliaMXO.sendPropertiesLegacySupport(true, sendPropertiesRequest);
    	}
} catch (ExecutionException e) {
    	e.printStackTrace();
} catch (MXOErrorApi mxoErrorApi) {
    	mxoErrorApi.printStackTrace();
} catch (MXOErrorSdk mxoErrorSdk) {
    	mxoErrorSdk.printStackTrace();
} catch (Exception e) {
    	e.printStackTrace();
}

This sends a PUT request to Medallia Experience Orchestration.

Important: Properties sent to a base Touchpoint will be captured under a base (/) or wildcard (/*) Interaction in Medallia Experience Orchestration. The Attribute Capture Point API name in Orchestration must match the key name sent above.

Sending Properties to an Interaction

To send Properties with a specific Interaction, call the mxoSendProperties Kotlin top-level function in a Coroutine or the MedalliaMXO.sendInteraction Java method passing an array of defined Properties, as shown below:

import com.medallia.mxo.interactions.MXOInteraction
import com.medallia.mxo.mxoSendProperties
import java.net.URI

scope.launch {
	mxoSendProperties {
        	interaction = MXOInteraction(URI("/InteractionPath"))
        	properties = myProperties
    	}
}
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.interactions.MXOInteraction;
import com.medallia.mxo.interactions.MXOInteractionRequest;
import java.net.URI;

final MXOInteractionRequest sendPropertiesRequest = new MXOInteractionRequest.Builder()
        .interaction(new MXOInteraction(URI.create("/InteractionPath")))
        .properties(myProperties)
        .build();
try {
	MedalliaMXO.sendProperties(sendPropertiesRequest);
} catch (Exception e) {
      e.printStackTrace();
} 

To capture errors, set the throwErrors parameter to true and wrap the method in a try/catch block, as shown below:

import android.content.ContentValues.TAG
import android.util.Log
import com.medallia.mxo.MXOErrorApi
import com.medallia.mxo.MXOErrorSdk
import com.medallia.mxo.interactions.MXOInteraction
import com.medallia.mxo.mxoSendProperties
import java.net.URI

scope.launch {
	try {
       		mxoSendProperties(throwErrors = true) {
            		interaction = MXOInteraction(URI("/InteractionPath"))
            		properties = myProperties
        	}
    } catch (error: MXOErrorSdk) {
        Log.e(TAG, "SDK Error: ${error.errorMessage}")
    } catch (error: MXOErrorApi) {
        Log.e(TAG, "Api Error: ${error.errorMessage}")
    }
}
import com.medallia.mxo.MedalliaMXO;
import com.medallia.mxo.interactions.MXOInteraction;
import com.medallia.mxo.interactions.MXOInteractionRequest;
import com.medallia.mxo.MXOErrorApi;
import com.medallia.mxo.MXOErrorSdk;
import java.net.URI;

final MXOInteractionRequest sendPropertiesRequest = new MXOInteractionRequest.Builder()
        .interaction(new MXOInteraction(URI.create("/InteractionPath")))
        .properties(myProperties)
        .build();
try {
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        	MedalliaMXO.sendProperties(true, sendPropertiesRequest);
    	} else {
        	MedalliaMXO.sendPropertiesLegacySupport(true, sendPropertiesRequest);
    	}
} catch (ExecutionException e) {
	e.printStackTrace();
} catch (MXOErrorApi mxoErrorApi) {
	mxoErrorApi.printStackTrace();
} catch (MXOErrorSdk mxoErrorSdk) {
	mxoErrorSdk.printStackTrace();
} catch (Exception e) {
	e.printStackTrace();
}

This sends a PUT request to Medallia Experience Orchestration.