# Call Wrapped

In 
Published 2024-01-29

# Usage

A call interaction is wrapped (completed) by either the agent or the autowrap feature.

# Syntax

webClient.onCallWrapped(listener: Function);

# Arguments

Name Type Description
listener function JavaScript method executed when the API method call is completed

# Sample Javascript

const callback = (response) => {
    if (response.error) console.error(response.error);
    if (response.result)
        alert(response.result);
}
webClient.onCallWrapped(callback);

# Response

This method is asynchronous. The response is returned in an object passed to a callback method. The response object contains the following fields.

Result
Example success Response

Returns this object if the API method call was invoked successfully, false otherwise.

{
    result: {
        agentInteractionId: number;
        callScore: number;
        wrapCode: number;
        wrapNote: string;
        keepLead: boolean;
        callType: string;
        timestamp: number; // Unix timestamp
    }
}