Request a Back In Stock Alert

Request an Back in Stock alert for an out of stock product.

swat.sendWatchlist

Subscribe to a product alert for an out-of-stock item using this API. Once the product becomes available again, meeting all relevant conditions, subscribers who have registered through this API will receive an alert email. This email will inform them that the product they're interested in is now back in stock.

Definition

swat.sendWatchlist(mediumValue, medium, product, onSuccess, onError, addToMailingListopt)

Example

Using the following information, this example demonstrates how to register a back-in-stock alert request on the Swym platform.

// Define the email address you want to subscribe to
let mediumValue = "[email protected]";
let medium = "email";

// Product data of the product
let product = {
 	epi: 41254709264582, // unique variant ID of the product.
 	empi: 7096252727494, // Product ID or master product ID
 	du: "https://demo.swym.it/products/1-light-pendant", // canonical product url.
 	iu: "https://a.com/b.jpeg", // image url for email
 	pr: 230, // price
 	et: 8 // event type 8 stands for registering a "notify me" event.
 }

 let onSuccess = function(response) {
 	console.log("Successfully Subscribed the email for the alert.", response);
 }
 
 let onError = function(error) {
 	console.log("There was an Error while subscribing the email for the alert.", error);
 }
 
 // Sample call..
  swat.sendWatchlist(mediumValue, medium, product, onSuccess, onError, 1);

API Parameters

ArgumentTypeDescription
mediumValuestringValue of the medium (currently supported ‘email’, hence email Id)
mediumstringWhat id is collected (currently 'email' supported)
productobjectproduct that is the content the out of stock alert
callbackFnfunctionFunction that gets called after a successful HTTP API call
errorCallbackfunctionThe error callback function which will be called on unsuccessful response
addToMailingList
(optional)
intPossible values: 1(opted in) or 0(opted out), to tell if user will be added to the mailing list (Note:- requires mailing list feature to be set up from Swym's end)

Other References

product

This is a JavaScript object that contains the following keys. Each key is necessary for successfully subscribing to alerts on that product.

Property NameData TypeRequiredDescription
epiint/stringYesVariant id of the product to be added
empiint/stringYesProduct id of the product to be added
dustringYesCanonical URL of the product to be subscribed.
prnumberYesproduct price / variant price
iu stringYesimage url of the product without protocol ( "https:")

Render Default form

😐

Not Interested in Crafting My Own Form

If you're not interested in creating a custom form and prefer to display the default form under specific conditions, make use of the "Email Me When Available Widget API".