sendInteractionResponseCode

Sending an Interaction response code can be useful when displaying Optimizations programmatically and capturing the user's response.

To send a response code, call the following, with the response code and the corresponding Interaction path as parameters, as shown below:sendInteractionResponseCode(request: MXOResponseCodeRequest | null): Promise<MXOResult<MXOInteractionResponse>>

Example of usage:

// Assumes the Interaction response code came from the response from using the sendInteraction API const interactionResponse = { interaction : 'react://touchpoint/interaction', responseCode : '9IJHB567HGDDS93DGJBVFSSE88711RKJHRFDSS' } MedalliaMXO.sendInteractionResponseCode(interactionResponse) .then(mxoResult => { if (mxoResult.value && mxoResult.value.apiName) { // error case console.error(mxoResult.value) } else { // success case console.log("The response code is sent: ", mxoResult.value) } }) .catch(error => { console.error(error) }) try { // Assumes the Interaction response code came from the response from using the sendInteraction API const interactionResponse : MXOResponseCodeRequest = { interaction : 'react://touchpoint/interaction', responseCode : '9IJHB567HGDDS93DGJBVFSSE88711RKJHRFDSS' } const {value} = await MedalliaMXO.sendInteractionResponseCode(interactionResponse) if (value && value.apiName) { // error case console.error(value) } else { // success case console.log("The response code is sent: ", value) } } catch (error) { console.error(error) }
Tip: When sending an Interaction response code programmatically, ensure the interaction is a fully qualified URI, containing the scheme, authority, and path. For example, react://touchpoint/interaction.