# Get Agent Presence

In 

# Usage

Returns both the description of the current agent state along with a timestamp showing the commencement, and the previous agent state also with the timestamp of the change into that state. These timestamps allow you to calculate how long the agent has been in a given state.

# Syntax

webClient.getAgentPresence(): Promise;

# Sample Javascript

import IpscapeWebClient from '@ipscape/web-client';

// Create a new instance of the IpSCAPE Web Client
const webClient = new IpscapeWebClient();

// Make request
webclient.getAgentPresence().then((response) => {
    if(response.success) {
        alert(response.result);
    }
    else {
        console.error(response.error);
    }
});

# Response

This method returns a promise. The resolved response is returned in an object and contains the following:

Result
Example success Response

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

{
    success: boolean;
    result: {
        state: {
            current: AgentPresenseObject;
            previous: AgentPresenseObject;
        };
        timestamp: number; // Unix timestamp
    }
}