The `recombee-js-api-client` is a client-side JavaScript SDK designed for seamless integration with the Recombee recommendation API. Currently at version 6.2.1, it provides a thin wrapper around the Recombee API, enabling applications to send user-item interactions (such as detail views, purchases, or cart additions) and request personalized recommendations or search results. The library exhibits an active release cadence, with multiple minor and major versions released recently, indicating ongoing development and improvements. Key differentiators include its UMD compatibility, built-in TypeScript definitions, and its specific design for browser-based or other client-side environments like React Native or NativeScript. It is crucial to note that this client-side SDK focuses on data collection and recommendation retrieval using a public token and does not support catalog management operations for security reasons, which are handled by a separate server-side Node.js SDK.
npm install recombee-js-api-clientVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing the Recombee client, sending a user-item interaction (a detail view), and requesting item-to-item recommendations with specified properties, including basic error handling.
Always consult the official Recombee JavaScript API Client documentation for the relevant version's upgrade guide before performing a major version update.
For server-side Node.js applications or catalog management, use the dedicated `recombee-api-client` package. Ensure server-side logic handles all operations that require a private token.
Obtain and use your Recombee public token from the Admin UI for all client-side integrations. Private tokens are strictly for secure server-side environments.
Upgrade your Node.js environment to version 18 or newer to ensure compatibility and proper functioning of the library.
Import the default `recombee` object first (`import recombee from 'recombee-js-api-client';`), then access `ApiClient` as a property (`new recombee.ApiClient(...)`). If using CommonJS, use `const recombee = require('recombee-js-api-client');`.Double-check your Recombee database ID and public token in the Recombee Admin UI. Ensure the public token is used for client-side applications and is still valid.
If using a `<script>` tag, verify the path to the `recombee-api-client.min.js` file and ensure it loads before any consuming scripts. If using a module bundler, ensure `import recombee from 'recombee-js-api-client';` is at the top of your file.
Implement robust error handling with fallbacks for API requests. You can also increase the timeout duration by providing a `timeout` option during `ApiClient` initialization, e.g., `new recombee.ApiClient(dbId, token, { timeout: 10000 })` for a 10-second timeout.No dependency data recorded yet.