Data Methods

You can use the data methods to retrieve information about the different objects on a page. The data methods are available in all locations - notification_card, conversation_card, widget_conversation_card, and widget_notification_card.

loggedInAgent

Returns details of the agent who is logged into the Freshcaller web UI or widget.

Copied Copy
1
2
3
4
5
6
7
8
client.data.get("loggedInAgent").then ( function(data) { // success output }, function(error) { // failure operation } );

Sample Output Payload

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{ "id": "1", "abilities": [ "view_customers", "manage_customers", "view_my_calls", "view_rules", "manage_rules", "view_admin", "view_billing", ], "name": "sample", "timeZone": "Caracas", "email": "karthikeyan.arumugam@freshworks.com", "phone": "", "mobile": null, "lastCallAt": "2019-07-11T03:04:31.000-04:00", "confirmed": true, "language": "en", "ringOnSpeakers": true, "status": "online", "mobileStatus": "offline", "sipStatus": 0, "sipEnabled": false, "lastSeenAt": "2019-07-11T03:10:19.000-04:00", }
EXPAND ↓

Attributes of the loggedInAgent Object

Attribute Date Type Description
id string Identifies the logged in agent
abilities array of string Specifies the permissions provided for the agent
name string Agent’s name
timeZone string Agent’s time zone
email string Agent’s email id
phone string Agent’s phone number
mobile string Agent’s mobile number
lastCallAt string Time when the agent last received a call, specified in the date-time format
confirmed boolean Specifies if the agent uses a confirmed account
language string Agent’s preferred conversational language
ringOnSpeakers boolean Specifies if the agent, in the profile settings, has chosen the ring on speakers and headphones option
status string 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
mobileStatus string Agent’s status on the mobile app
sipStatus boolean Specifies if the agent, in the profile settings, has chosen the Receive calls on SIP Phone option.
sipEnabled boolean Specifies if SIP is enabled for the agent
Possible values: true (the agent’s name is added to the SIP credentials when the SIP phone is configured), false
lastSeenAt string Time the agent was last online, specified in the date-time format

domainName

Returns the domain details of the business account that uses Freshcaller.

Copied Copy
1
2
3
4
5
6
7
8
client.data.get("domainName").then ( function(data) { //Success output }, function(error) { // failure operation } );

Sample Output Payload

1
https://sample.freshcaller.com
EXPAND ↓

Data Returned by the domainName Object

Date Type Description
string Domain name assigned by Freshcaller, for a business account
currentCall

Returns details of an on-going call.

Copied Copy
1
2
3
4
5
6
7
8
client.data.get("currentCall").then ( function(data) { // success output }, function(error) { // failure operation } );

Sample Output Payload

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{ “callDuration”: 5, "caller": { "id": 20, "from": "+12345678900", "location": "NJ, ENGLEWOOD, US" }, "id": 412, “isBeingRecorded”: true, “muted”: true, “notes”: “Sample note”, “previousStatus”: “transferring”, “status”: “completed”, "type": "incoming" }
EXPAND ↓

Attributes of the currentCall Object

Attribute Date Type Description
callDuration number Specifies the time, in seconds, elapsed since the start of the call
caller currentCaller object Caller information. The attribute value is a caller object.

Attributes of the caller object
Id (number): Identifies a caller
from or to (string): Number from which the call originates or to which the call is made
Location (string): Location from where the call originates
id number ID associated with a call
isBeingRecorded boolean Specifies if the call is recorded
isMuted boolean Specifies if the call is muted
notes string 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.
previousStatus string Previous status of the call
Possible values: in progress, on-hold, completed, transferring, transferred, transfer unavailable, warm transferring, warm transferred, and warm transfer unavailable
status string Status of the current call
Possible values: in progress, on-hold, completed, transferring, transferred, transfer unavailable, warm transferring, warm transferred, and warm transfer unavailable
type string Type of the current call
Possible values: incoming, outgoing, transfer, warm_transfer, agent_conference, monitor, and barge
currentCaller

Returns details of the current caller.

Copied Copy
1
2
3
4
5
6
7
8
client.data.get("currentCaller").then ( function(data) { // success output }, function(error) { // failure operation } );

Sample Output Payload

1
2
3
4
5
6
7
8
9
{ "id": "35", "address": "# 27, Perungalathur, Chennai - 600063.", "companyId": "3", "email": "raj.praveen@freshworks.com", "lastCallAt": "2019-07-11T06:33:51.000-04:00", "name": "Raju", "totalCalls": 85 }
EXPAND ↓

Attributes of the currentCaller Object

Attribute Date Type Description
id string Caller’s ID
address string Caller’s address
companyId string Caller’s company ID
email string Caller’s email ID
lastCallAt string Time of the last call with the caller, in the date-time format
name string Caller’s name
totalCalls number Total number of calls to or from the caller
currentNumber

Returns details of the number from which an outgoing call is made.

Copied Copy
1
2
3
4
5
6
7
8
client.data.get("currentNumber").then ( function(data) { // success output }, function(error) { // failure operation } );

Sample Output Payload

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{ "id": "274", “address”: “# 4, Lorem Ipsum”, “addressRequired”: true, "callerId": 5, "country": "US", "displayNumber": "(234) 567-8900", "holdMessageId": "1", "name": "Primary", "nextRenewalAt": "2019-03-25T09:28:39.000-04:00", "number": "+12345678900", "numberType": 1, "rate": 1, "recordType": 4, "region": "NJ", "ringtoneMessageId": "10", "ruleId": "151", "shortAbandonTimeout": 5, "teamIds": [ "5" ], “transcriptionEnabled”: true, "agentIds": [ "11" ] }
EXPAND ↓

Attributes of the currentNumber Object

Attribute Date Type Description
id string ID associated with a number, created when the number is created
address string Registered address for a number
addressRequired boolean Specifies if an address was required to buy the number
callerId string Identifier (caller ID) of the number that is used to mask a currentNumber, if masking is enabled for the number.
country string Country to which the number belongs
displayNumber string Specifies the number in the international format
holdMessageId string 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
name string Name configured for the number
nextRenewalAt string Date by when the number must be renewed, specified in the date-time format
number string Specifies the number in a standardized format
numberType string Specifies the type of the phone number
Possible values: 0 (toll free), 1 (local), 2 (mobile), and 3 (external)
rate number The renewal price that is deducted every month, for a number
recordType number 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), and 4 (Record manually)
ruleId string Identifies the rule associated with the number, if a rule is configured for the number
ringtoneMessageId string 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.
shortAbandonTimeout number 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.
teamIds Array of number Each array entry identifies a team that has access to the number
transcriptionEnabled boolean Specifies if voicemail transcription is enabled for the number
agentIds Array of number Each array entry identifies an agent who has access to the number