esales-api, is built on top of the Storefront API v3 and is designed to make it easy to communicate with Voyado Elevate via a browser or JavaScript runtime (like Node.js, Deno, and more). It provides methods to make HTTP requests available in the API as well as TypeScript models of the response objects.
Installation
The@apptus/esales-api package is available for installation via npm.
@apptus/esales-api
API instantiation
To work with theesales-api, the clusterId received during customer onboarding (or in the credentials tab in the Elevate app) is required, as well as the correct IDs for both market and locale. Additionally, a touchpoint with either 'desktop' or 'mobile' must be set. Below, the API object is instantiated as a constant, api.
Key handling
Theesales-api should be instantiated with a session property, which should be a function that returns the session and customer key to use. For more information on the key format and about identifying visitors, see Visitor identification.
- Synchronous usage
- Usage with Promise
localStorage, and there are methods to update or reset keys, which should be used when visitors sign in or out.
- Create localStorage session handler
- Retrieve sessionKey and customerKey
- Update customerKey
- Reset keys
Notifications
The JavaScript library includes methods for making notifications of each type. Once the API object has been instantiated, notifications can easily be made, as session and customer keys are automatically applied. Notifications are made viafetch() with the keepalive flag, so that browsers do not terminate the requests before they complete, such as when sending a click notification when a link is pressed.
All examples below have instantiated the API object as a constant, api.
- Click
- Add to cart
- Add favorite
- Remove favorite
Queries
Queries can be made by passing query parameters as an object and, for most types of queries, an optional body. The body is used to configure the types of data that will be returned from the API. All examples below have instantiated the API object as a constant,api, and will therefore automatically include query parameters for market, locale, touchpoint, sessionKey, and customerKey. They show minimal usage: only the required parameters, and no request body. For the full list of parameters and body options, see the API specification.
- Autocomplete
- Cart page
- Content information
- Content search page
- Landing page
- Product page
- Search page

