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 (Freshworks product) 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 Freshworks product 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.

loggedInAgent

Use the sample code shown on the right pane > Sample code tab, to retrieve information on the agent logged into the Freshworks product UI.

Attributes of the loggedInAgent object

  • idinteger

    Identifier of the agent, auto-generated when the agent’s information is configured in the system.

  • emailstring

    Email address of the agent specified when the agent information is created in the Freshworks product system.

  • avatarobject

    Details of the image used as the avatar in the agent profile.

  • phonestring

    Phone number of the agent.

  • biographystring

    Description of the agent.

  • first_namestring

    First name of the agent.

  • last_namestring

    Last name of the agent.

  • social_profilesobject

    Information pertaining to the social profiles associated with the agent.

currentHost

An app created using platform version 3.0 can be deployed on several Freshworks products.

Use the sample code shown on the right pane > Sample code tab, to retrieve information of the Freshworks product where the app is currently deployed.

Attributes of the currentHost object

  • subscribed_modulesarray of strings

    List of modules supported by the app, specified as an array.

  • endpoint_urlsobject

    Information pertaining to the Freshworks product. It defines the name and account URL of the Freshworks product as a key (product name) - value (account URL) pair.