freshdesk-api is a Node.js wrapper for the Freshdesk v2 API, providing a convenient and typed interface for interacting with Freshdesk services. The current stable version is 3.1.0. The package has an active release cadence, with significant updates and new features being added regularly, alongside dependency maintenance and bug fixes. It differentiates itself by offering full TypeScript support and leveraging `undici` for efficient HTTP requests, though note that attachment handling still relies on `form-data`. This client is designed for server-side Node.js applications that need to integrate with Freshdesk for ticket management, contact synchronization, and other API operations, offering a more modern alternative to older v1 API clients.
npm install freshdesk-apiVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the Freshdesk API client using environment variables and demonstrates how to create a new ticket and then fetch its details, including robust error handling.
Migrate from `bluebird`'s promisified methods (e.g., `getTicketAsync`) to native async/await syntax or explicit Promise wrapping for API calls (e.g., `await freshdesk.getTicket(...)`).
Review any custom HTTP client configurations or assumptions made about the underlying `request` library. Most direct API calls should remain compatible, but behavior for edge cases or advanced HTTP options might differ.
When testing or mocking `freshdesk-api`, use `Undici`'s built-in mocking functionality for most requests. For form-data/attachment requests, `nock` remains a viable option. Alternatively, use a client-agnostic mock server.
Upgrade to `freshdesk-api` version 3.1.0 or newer, which includes a fix to correctly handle rate limit responses and return the `retry-after` header in `FreshdeskError`.
Upgrade to `freshdesk-api` version 3.1.0 or newer. Ensure your API calls respect Freshdesk's rate limits. Check the `FreshdeskError` object for `retry-after` details.
Double-check your `FRESHDESK_DOMAIN` and `FRESHDESK_API_KEY` environment variables or configuration. Ensure the API key has the necessary permissions for the operations being performed.
For ESM, use `import Freshdesk from 'freshdesk-api';`. For CommonJS, use `const Freshdesk = require('freshdesk-api');`. Ensure you are not destructuring the `Freshdesk` class from the import.No dependency data recorded yet.