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 (Freshsales Suite) 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 Freshsales Suite 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.
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 on the user logged into the Freshsales Suite UI.
Attributes of the loggedInUser object
- idinteger
Identifier of the user.
- display_namestring
Display name of the user.
- emailstring
Email address of the user.
- is_activeboolean
Specifies whether the user is active to accept new leads, contacts, tasks, appointments, and so on.
- work_numberstring
Official number of the user.
- mobile_numberstring
Mobile number of the user.
- confirmedboolean
Specifies whether the user has accepted the account activation mail.
- privilegesstring
Access privileges assigned to the user, specified through a role id.
- job_titlestring
Designation of the user.
- languagestring
Language of the user, in the ISO-639 code. By default, the value of this attribute is en.
- last_login_atstring
Timestamp of when the user last logged into the Freshsales Suite system, specified in the UTC format.
- time_zonestring
Time zone to which the user belongs.
- avatarstring
URL of the image used as the avatar.
- signaturestring
HTML format of the personalized message block appended to the emails/replies that the user sends.
- access_scopestring
Access scope of the user based on the role assigned to the user. The access can be global, restricted, or territory.
- abilitiesarray of strings
List of the access privileges granted to the agent, specified as an array.
- reply_tostring
Email address in which the user can receive responses.
- fromstring
Email address using which the user can send emails from the Freshsales Suite account.
- plan_namestring
Freshsales Suite plan under which the user’s account falls.
- imap_configured_emailstring
User’s email address that is connected to Freshsales Suite so that all prospect details are received directly in the product.
- deal_pipeline_idstring
Identifier of preferred deal pipeline that is associated with the user..
- created_atstring
Timestamp of when the logged in user’s details are saved in Freshsales Suite, specified in the UTC format.
- is_forgottenboolean
Specifies whether the user details are permanently deleted from the Freshsales Suite system.
- role_idnumber
Identifier of the role associated with the user. When a role is configured in Freshsales Suite, an auto-generated identifier is associated with the role.
- territory_idsarray of strings
Identifiers of the territories to which the user is associated for auto-assignment of prospects.
- account_idinteger
Identifier of the Freshsales Suite account to which the user is associated.
- sales_activity_type_idsarray of numbers
Identifiers of all sales activity types configured for a user
domainName
Use the sample code shown on the right pane > Sample code tab, to retrieve the domain name of the business account that uses Freshsales Suite and a product context that can be used in the app logic.
Attributes of the domainName object
- domainNamestring
Domain name assigned by Freshworks, for a business account.
If the app is deployed on an Freshsales Suite account, the domainName is <sub-domain>.myfreshworks.com.
If the app is deployed on a Freshsales Suite account that has been migrated from a Freshsales Classic account, the domainName is <sub-domain>.freshworks.com. - productContextobject
Product context of the product for which the app is installed.
Contact details page
An app deployed on the Contact details page can use the client.data.get(<objectName>) data method and retrieve the following object:
currentEntityInfo
Use the sample code shown on the right pane > Sample code tab, to retrieve information of a contact, when an agent is on the Contact details page.
Attributes of the currentEntityInfo object
- currentEntityIdinteger
Identifier of the contact.
- currentEntityTypestring
Type of page.
Deal details page
An app deployed on the Deal details page can use the client.data.get(<objectName>) data method and retrieve the following object:
currentEntityInfo
Use the sample code shown on the right pane > Sample code tab, to retrieve information of a deal, when an agent is on the Deal details page.
Attributes of the currentEntityInfo object
- currentEntityIdinteger
Identifier of the deal.
- currentEntityTypestring
Type of page.
Sales account details page
An app deployed on the Sales account details page can use the client.data.get(<objectName>) data method and retrieve the following object:
currentEntityInfo
Use the sample code shown on the right pane > Sample code tab, to retrieve information of an account, when an agent is on the Sales account details page.
Attributes of the currentEntityInfo object
- currentEntityIdinteger
Identifier of the account.
- currentEntityTypestring
Type of page.