Search.../

getBackInStockNotificationRequest( )

Developer Preview

Retrieves a back in stock notification request.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function getBackInStockNotificationRequest(_id: string): Promise<BackInStockNotificationRequest>

getBackInStockNotificationRequest Parameters

NAME
TYPE
DESCRIPTION
_id
string

ID of the notification request to retrieve.

Returns

Retrieved back in stock notification request.

Return Type:

Promise<
BackInStockNotificationRequest
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time the notification request was created.

_id
string

Request ID.

autoNotified
boolean

Whether a notification was sent automatically.

autoNotified is empty when the notification request is created and is not returned until the field has a value. autoNotified receives a value when a notification email is sent for this request object.

autoNotified sets to true if the notification is sent through the site, either automatically or with the reportItemsBackInStock() function. If the notification email is sent offline but the status is updated with the markAsNotificationSent() function, then autoNotified sets to false.

catalogReference
CatalogReference

Catalog and item reference that the notification request is for.

Includes IDs for the catalog and item it came from, as well as additional, optional information.

contactId
string

Contact ID for the contact with this email.

If a contact does not already exist with the email address submitted when creating this request, then a new contact is created. For more information about contacts, see the Contacts API.

email
string

Email address to send notification to about item being back in stock.

itemUrl
string

Item URL for this request.

status
string

Status of the notification.

status is set to RECEIVED when the notification request is created. The status changes once a notification email is sent for this request object:

  • When a notification email is sent through the site, either automatically or with the reportItemsBackInStock() function, then the status is briefly set to PROCESSING and then set to NOTIFICATION_SENT if the email is successul, and FAILED if it fails.
  • When a notification email is sent offline, use the markAsNotificationSent() function to set status to NOTIFICATION_SENT.

Was this helpful?

getBackInStockNotificationRequest example

Copy Code
1import { backInStockNotifications } from 'wix-ecom-backend';
2
3 async function getBackInStockNotificationRequest(id) {
4 try {
5 const result = await backInStockNotifications.getBackInStockNotificationRequest(id);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13