Quick start
Follow installation instructions to install the API SDK, and then bring the Freshteam
class into scope.
const { Freshteam } = require("@freshworks/api-sdk");
const ft = new Freshteam(domain, apiKey);
Call a method, e.g., list all employees (who match a search criteria):
const res = await ft.employees.list({ first_name: "Arthur", last_name: "Dent" });
// Access the response body as an Array of `Employee` objects
const employees = res.json();
Models
The Freshteam
class includes a static property called models
. All models used by the API methods below can be accessed from there.
For example:
// Create a new EmployeeCreate model to pass to employees.create() method
const newEmp = new Freshteam.models.EmployeeCreate("Arthur", "Dent", "arthur@heartofgold.com", [300060409]);
API methods
API methods are the methods you'd interact primarily with. Each method is async
and returns a Promise
. So, you can either chain the method calls with .then()
or call them using async/await
syntax.