reportItemsBackInStock( )
Sends notifications for back in stock requests.
Description
Important: Automations must be turned on in a site's dashboard for notifications to send.
This endpoint triggers notifications for requests in 1 of 2 ways:
- For a specific item, with the
catalogReference
information. - For specific requests, with
requestIds
.
itemDetails
are required and may populate dynamic values in the notification template, as follows:
itemDetails.name
passes to the template asitem.name
itemDetails.price
passes to the template asitem.price
itemDetails.image.url
passes to the template asitem.image.url
If the notification template doesn't include item.price
, item.name
, or item.image.url
, values should
be passed in extraAutomationTemplateParameters
.
After this endpoint is called, the status
for the request will update to NOTIFICATION_SENT
if it sends
successfully, or to FAILED
if it fails to send.
Syntax
function reportItemsBackInStock(itemDetails: BackInStockItemDetails, options: ReportItemsBackInStockOptions): Promise<void>
reportItemsBackInStock Parameters
NAME
TYPE
DESCRIPTION
Item details to use in notifications.
itemDetails
may populate dynamic valyes in the notification template, as follows:
itemDetails.name
passes to the template asitem.name
itemDetails.price
passes to the template asitem.price
itemDetails.image.url
passes to the template asitem.image.url
Use extraAutomationTemplateParameters
to pass additional dynamic values.
Report options.
Returns
Return Type:
Was this helpful?
reportItemsBackInStock example
1import { backInStockNotifications } from 'wix-ecom-backend';23 async function reportItemsBackInStock(itemDetails, options) {4 try {5 const result = await backInStockNotifications.reportItemsBackInStock(itemDetails, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13