# Agent Login

Published 2024-01-29

# Usage

Fired after a successful agent login.

# Syntax

webClient.onAgentLogin(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)

# Response

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

Example success Response

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

  result: {
    agentId: number;
    agentConnection: AgentVoiceConnection;
    agentDisplayName: string;
    agentFirstName: string;
    agentLastName: atring;
    agentPermission: AgentPermissions
    agentTimezone: string; // ie: "Australia/Sydney"
    countryCode: string
    email: string;
    username: string
    timestamp: number; // unix timestamp
Example error Response

If the login was successful, this variable is not returned. If the login failed, this variable returns an array of error messages.

  error: ErrorResponse[];