Use data method

Data method is an interface that the developer platform provides to enable your app to retrieve product data (in the form of JSON payloads).

When an app is initialized successfully, the parent app (Freshcaller) passes a client reference to your app. Your app can use this reference and the developer platform’s data method to retrieve the different objects on the Freshcaller UI, as payloads.

To enable your app to retrieve product data, in the app.js file,

  1. Subscribe to the app.initialized event, through an event listener. When the app is initialized, the parent application passes a client reference to the app.
  2. After app initialization, use the data method - client.data.get(<objectName>) - to retrieve the specified object (<objectName>) from the product UI.

As part of the app logic, your app can process the retrieved payload to derive meaningful results.

This section,

  • Lists all the objects that can be retrieved by using the data method.
  • Describes all the attributes of the retrieved object.

Note:Any front-end app deployed in any of the placeholders, can retrieve any (or all) of the objects listed in this section.

loggedInAgent

Use the sample code shown on the right pane > Sample code tab, to retrieve information of the agent who is logged into the Freshcaller web UI or widget.

Attributes of the loggedInAgent object

  • abilitiesarray of string

    Specifies the permissions provided for the agent.

  • confirmedboolean

    Specifies if the agent uses a confirmed account.

  • emailstring

    Agent’s email id.

  • idstring

    Identifies the logged in agent.

  • languagestring

    Agent’s preferred conversational language.

  • lastCallAtstring

    Time when the agent last received a call, specified in the date-time format.

  • lastSeenAtstring

    Time the agent was last online, specified in the date-time format

  • mobilestring

    Agent’s mobile number.

  • mobileStatusstring

    Agent’s status on the mobile app.

  • namestring

    Agent’s name.

  • phonestring

    Agent’s phone number.

  • ringOnSpeakersboolean

    Specifies if the agent, in the profile settings, has chosen the ring on speakers and headphones option.

    Possible values: true, false

  • sipEnabledboolean

    Specifies if SIP is enabled for the agent.
    The agent’s name is added to the SIP credentials when the SIP phone is configured when sipEnabled is true.
    Possible values: true, false

  • sipStatusboolean

    Specifies if the agent, in the profile settings, has chosen the Receive calls on SIP Phone option.
    Possible values: true, false

  • statusstring

    Status of the agent. An agent can set the status to online or offline. Also, the status can be automatically set to busy (during a call) and acw (after a call). Possible values: online, busy, acw, and offline

  • timeZonestring

    Agent’s time zone.

domainName

Use the sample code shown on the right pane > Sample code tab, to retrieve domain details of the business account that uses Freshcaller.

currentCall

Use the sample code shown on the right pane > Sample code tab, to retrieve information of an on-going call.

Attributes of the currentCall object

  • callDurationinteger

    Specifies the time, in seconds, elapsed since the start of the call.

  • callerobject

    Caller information. The attribute value is a caller object.

  • idinteger

    ID associated with a call.

  • isBeingRecordedboolean

    Specifies if the call is recorded.

  • isMutedboolean

    Specifies if the call is muted.

  • notesstring

    Notes associated with the call. After a call is established the Notes field is enabled in the conversation window, for an agent to record the details of a conversation.

  • previousStatusstring

    Previous status of the call.
    Possible values: in progress, on-hold, completed, transferring, transferred, transfer unavailable, warm transferring, warm transferred, and warm transfer unavailable

  • statusstring

    Status of the current call.
    Possible values: in progress, on-hold, completed, transferring, transferred, transfer unavailable, warm transferring, warm transferred, and warm transfer unavailable

  • typestring

    Type of the current call.
    Possible values: incoming, outgoing, transfer, warm_transfer, agent_conference, monitor, and barge

currentCaller

Use the sample code shown on the right pane > Sample code tab, to retrieve information of the current caller.

Attributes of the currentCaller object

  • addressstring

    Caller’s address.

  • companyIdstring

    Caller’s company ID.

  • emailstring

    Caller’s email ID.

  • idstring

    Caller’s ID.

  • lastCallAtstring

    Time of the last call with the caller, in the date-time format.

  • namestring

    Caller’s name.

  • totalCallsinetger

    Total number of calls to or from the caller.

currentNumber

Use the sample code shown on the right pane > Sample code tab, to retrieve information of the number from which an outgoing call is made.

Attributes of the currentNumber object

  • addressstring

    Registered address for a number.

  • addressRequiredboolean

    Specifies if an address was required to buy the number.

  • agentIdsArray of strings

    Each array entry identifies an agent who has access to the number.

  • callerIdstring

    Identifier (caller ID) of the number that is used to mask a currentNumber, if masking is enabled for the number.

  • countrystring

    Country to which the number belongs.

  • displayNumberstring

    Specifies the number in the international format.

  • holdMessageIdstring

    Identifies the hold message. A hold message can be a custom message or can be the default welcome message, voicemail message, or hang-up message.

  • idstring

    ID associated with a number, created when the number is created.

  • namestring

    Name configured for the number.

  • nextRenewalAtstring

    Date by when the number must be renewed, specified in the date-time format.

  • numberstring

    Specifies the number in a standardized format.

  • numberTypestring

    Specifies the type of the phone number.
    Possible values:

    • 0 (toll free)
    • 1 (local)
    • 2 (mobile)
    • 3 (external)
  • rateinteger

    The renewal price that is deducted every month, for a number.

  • recordTypeinteger

    Specifies if the calls received at the number or made from the number must be recorded and if so what to record and how to record the calls (automatically or manually)
    Possible values:

    • 0 (Do not record calls)
    • 1 (Record all calls)
    • 2 (Record incoming calls)
    • 3 (Record outgoing calls)
    • 4 (Record manually)
  • ruleIdstring

    Identifies the rule associated with the number, if a rule is configured for the number.

  • ringtoneMessageIdstring

    Identifies the ringtone message. A ringtone message can be a custom message or can be the default welcome message, voicemail message, or hang-up message.

  • shortAbandonTimeoutinteger

    Specifies the threshold (in seconds) within which if a call is abandoned, the call is considered a missed call. The field is valid only for incoming calls.

  • teamIdsArray of integers

    Each array entry identifies a team that has access to the number.

  • transcriptionEnabledboolean

    Specifies if voicemail transcription is enabled for the number.

    possible values: true, false