Skip to main content

subscribeByMarker

Subscribe to a product event. 🔐 This method requires authorization.

Description​

Subscribes the authenticated user to an event for a product, such as a price drop or a status change. Resolves to true when the subscription is created (the API responds with 204 and no body).

With the default errors.isShell: true, a failed request resolves to an IError object, never to false. An error object is truthy, so check result === true rather than if (result). With errors.isShell: false the method throws instead.

.subscribeByMarker(

, ,

);

Parameters schema​

Schema

marker(required): string
Marker of the event.
example: "product_price_change"

productId(required): number
Product ID.
example: 12345

langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"

Examples​

Minimal example​

const result = await Events.subscribeByMarker('product_price_change', 12345);
if (result !== true) console.error(result); // IError

Example with optional parameters​

const result = await Events.subscribeByMarker('product_price_change', 12345, 'en_US');