Guides
Breadcrumbs

miniAppResult

Introduction

When a project uses a CCaaS provider such as Genesys or NICE inContact, the end results of the Omilia part of the interaction are collected in an object called miniAppResult. All the information collected in this object is then passed from the OCP back to the CCaaS through the the session-handling API and adds the miniAppResult data in the session. From there they can be parsed and used in numerous ways such as routing decisions, agent screens population, data dips, reporting, and so on. Omilia's standard telephony integration for all the supported CCaaS providers includes scripts that parse the miniAppResult.

  • Implementations in Talkdesk, such as direct SIP integrations, do not require a miniAppResult object to return to the CCaaS provider. Use the Transfer block of Orchestrator instead.

  • Implementations without a CCaaS provider and with direct SIP integration do not use the miniAppResult object.

miniApp implementations

For standalone miniApp implementations, the miniAppResult is set by the miniApp and cannot be modified. Use a CCaaS script to read the miniAppResult for proper call handling.

During a dialog session, each miniApp produces an output returned in the miniAppResult field. Below are its possible keys with brief descriptions.

Key name

Description

transcription

All user utterances.

dialogId

DiaManT dialog ID.

duration

The call duration in milliseconds.

result

Indicates the result of the miniApp.
Possible values:success or fail.

This key depends directly on the fail_exit_reason key, which must be defined or undefined to obtain the result value.

step

The dialog step.

validation_result

Stores the result value of the miniApp validation.
Possible values:success or fail.

validation_success_name

Name of the validation that succeeded.

validation_fail_name

Name of the validation that failed.

validation_fail_reason

Reason the validation failed.

wrong_input

Number of wrong inputs.

mini_app_-_app_id

miniApp application ID.

mini_app_-_request_id

miniApp request ID.

timestamp

Call start timestamp.

language

The locale of the miniApp at runtime.

agent_requests

Number of agent requests.

no_matches

Count of no_matches.

no_inputs

Count of no_inputs.

errors

Count of global errors.

fail_exit_reason

The reason the miniApp failed is described in the article Fail Exit Reason, which lists all possible values for fail_exit_reason.

closing_request_flag

Caller requests for the miniApp to close.
Possible values:true or false.

dtmf_intent

The last DTMF value provided from the caller during an Intent type miniApp.

input_value

The value that the miniApp got from user (for example, in Alphanumeric the value could be abc123 , however in a Date miniApp the value could be 20/02/1990).

Orchestrator implementations

For Orchestrator implementations, the miniAppResult should be created by an Intelli miniApp. This Intelli should have as input the data required to build the miniAppResult and as output the miniAppResult field. This field’s value should be a JSON object that contains all the information that should be passed to the next system. The Intelli that creates the miniAppResult should be added as:

  • the last block before the end of a call termination (transfer or system hangup)

  • the last block of the error handling flow(s)

Basic miniAppResult structure

When creating the miniAppResult JSON object for an Orchestrator application, the following elements are mandatory:

Element

Description

result

Possible values: success or fail.

  • Success indicates the application attempted to serve the call, not task or Flow success.

  • Fail indicates system failures outside the Orchestrator application.

Set the result to success whenever the call reaches the Orchestrator application.

closing_request_flag

Possible values: true or false.

  • When set to true the CCaaS script must terminate the call. This applies when the caller ends the interaction and requests call termination (also called NEAR_HUP), for example, after saying "That is all thank you". Additionally, closing_request_flag is set to true so the CCaaS terminates the session when the caller hangs up (also called FAR_HUP). By default, the flag is true.

  • The flag is set to false for transfers to avoid premature call termination.

input_value

Extra data that the CCaaS script should read delimited by pound #. In this element, you can choose which information collected by the speech application should pass to the CCaaS provider to properly serve the customer journey outside of OCP.

Sample JS

Below is some sample code that you can use to bootstrap your Intelli miniApp. It assumes as inputs:

  • Two fields to populate an agent screen (myField1 and myField2)

  • failExitReason as last set by the orchestrator application

The output is the miniAppResult JSON object. The Intelli miniApp that uses this sample code is the last one used before a transfer.

The following JS sample code is used as a function at the Output tab of the Intelli miniApp.

JSON
var closeFlag = "false";
try {
    var Inputs = {
        myField1: params.orchestratorInput1, // set orchestratorInput1 as miniApp input in your Orchestrator canvas
        myField2: params.orchestratorInput2, // set orchestratorInput2 as miniApp input in your Orchestrator canvas
        failExitReason: params.FailExitReason // set FailExitReason as miniApp input in your Orchestrator canvas
    }
} catch (err) {
    console.log("An error occured.");
    var Inputs = {
        myField1: "unknown",
        myField2: "unknown",
        failExitReason: "unknown"
        };
    }
    var miniAppResult = {
        result: "success",
        closing_request_flag: closeFlag,
        fail_exit_reason: Inputs.FailExitReason,
        "input_value": (
            "myField1:" + Inputs.myField1 + "#" +
            "myField2:" + Inputs.myField2)
    };
var Outputs = {
    output1: miniAppResult, // set miniAppResult as miniApp output in your Orchestrator canvas
    output2: closeFlag // set closeFlag as miniApp output in your Orchestrator canvas
};
Outputs;

When it comes to using the Orchestrator to parse the miniAppResult as an output of the Intelli miniApp, always use the output1/output2 notation as per the screenshot below.

image-20240520-145939.png

miniAppResult implementation best practices

Do not have spaces at the field value.

Do not create an Object-inside-an-Object. The Connector supports only a single-level depth object.

miniAppResult in Dialog End Event Handlers

  • When you use a Dialog End Event Handler to populate the miniAppResult, enable the Send data Before Session Close toggle to create your miniAppResult before passing the callback to the CCaaS provider.

Screenshot 2024-07-31 at 2.28.45 PM.png
  • After creating your Event Handler, click Deploy all.

  • The root Flow does not log the miniAppResult when it is created with an on Dialog End Event Handler. However, you should have available the Intelli output, if no encryption or masking is imposed.

  • Review the respective Orchestrator’s documentation for Event Handlers.

When to create the miniAppResult

The miniAppResult must be generated at the conclusion of the OCP session, specifically within the scope of a Dialog End Handler.

Dialog Event Handlers execute when a Dialog End event triggers, such as NEAR_HUP, FAR_HUP, or TRANSFER, before control passes to the CCaaS provider script.

From a technical perspective, an Intelli miniApp should be employed to create and populate the miniAppResult JSON object, embedding the required dataset to be transmitted to the CCaaS provider.

Advanced topics

What happens in the background (Orchestrator implementations)

The miniAppResult involves the OCP dialog manager passing the JSON object to the CCaaS-specific Connector, which then sends it to the CCaaS provider.