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,
- 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.
- 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.
Data objects accessible from all pages
These objects are available in all pages of the product UI. Irrespective of the page on which the app is deployed, when you use the data method -client.data.get(<objectName>)- and retrieve these objects, the corresponding payload is retrieved.
An app can retrieve the following objects irrespective of where the app is deployed:
loggedInUser
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 stringSpecifies the permissions provided for the agent. 
- confirmedbooleanSpecifies if the agent uses a confirmed account. 
- emailstringAgent’s email id. 
- idstringIdentifies the logged in agent. 
- languagestringAgent’s preferred conversational language. 
- lastCallAtstringTime when the agent last received a call, specified in the date-time format. 
- lastSeenAtstringTime the agent was last online, specified in the date-time format 
- mobilestringAgent’s mobile number. 
- mobileStatusstringAgent’s status on the mobile app. 
- namestringAgent’s name. 
- phonestringAgent’s phone number. 
- ringOnSpeakersbooleanSpecifies if the agent, in the profile settings, has chosen the ring on speakers and headphones option. Possible values: true, false 
- sipEnabledbooleanSpecifies 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 
- sipStatusbooleanSpecifies if the agent, in the profile settings, has chosen the Receive calls on SIP Phone option. Possible values: true, false 
- statusstringStatus 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 
- timeZonestringAgent’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
- callDurationintegerSpecifies the time, in seconds, elapsed since the start of the call. 
- callerobjectCaller information. The attribute value is a caller object. 
- idintegerID associated with a call. 
- isBeingRecordedbooleanSpecifies if the call is recorded. 
- isMutedbooleanSpecifies if the call is muted. 
- notesstringNotes 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. 
- previousStatusstringPrevious status of the call. 
 Possible values: in progress, on-hold, completed, transferring, transferred, transfer unavailable, warm transferring, warm transferred, and warm transfer unavailable
- statusstringStatus of the current call. 
 Possible values: in progress, on-hold, completed, transferring, transferred, transfer unavailable, warm transferring, warm transferred, and warm transfer unavailable
- typestringType 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
- addressstringCaller’s address. 
- companyIdstringCaller’s company ID. 
- emailstringCaller’s email ID. 
- idstringCaller’s ID. 
- lastCallAtstringTime of the last call with the caller, in the date-time format. 
- namestringCaller’s name. 
- totalCallsinetgerTotal 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
- addressstringRegistered address for a number. 
- addressRequiredbooleanSpecifies if an address was required to buy the number. 
- agentIdsArray of stringsEach array entry identifies an agent who has access to the number. 
- callerIdstringIdentifier (caller ID) of the number that is used to mask a currentNumber, if masking is enabled for the number. 
- countrystringCountry to which the number belongs. 
- displayNumberstringSpecifies the number in the international format. 
- holdMessageIdstringIdentifies the hold message. A hold message can be a custom message or can be the default welcome message, voicemail message, or hang-up message. 
- idstringID associated with a number, created when the number is created. 
- namestringName configured for the number. 
- nextRenewalAtstringDate by when the number must be renewed, specified in the date-time format. 
- numberstringSpecifies the number in a standardized format. 
- numberTypestringSpecifies the type of the phone number. 
 Possible values:- 0 (toll free)
- 1 (local)
- 2 (mobile)
- 3 (external)
 
- rateintegerThe renewal price that is deducted every month, for a number. 
- recordTypeintegerSpecifies 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)
 
- ruleIdstringIdentifies the rule associated with the number, if a rule is configured for the number. 
- ringtoneMessageIdstringIdentifies the ringtone message. A ringtone message can be a custom message or can be the default welcome message, voicemail message, or hang-up message. 
- shortAbandonTimeoutintegerSpecifies 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 integersEach array entry identifies a team that has access to the number. 
- transcriptionEnabledbooleanSpecifies if voicemail transcription is enabled for the number. possible values: true, false