Render an unsubscribe form

Render an Unsubscribe form for the storefront,

🚧

We are working on Improving this API.

If you find any information lacking - kindly contact [email protected]

swat.unsubscribeFromSwym(unsubMap, successCallback, errorCallback)

Unsubscribe page is to be hosted on the storefront. The page receives query params in the URL to specify the user context, product context the unsubscribe came from.

window.SwymCallbacks = window.SwymCallbacks || [];
window.SwymCallbacks.push(function(swat) {
  var params = SwymUtils.getEncodedAsObject(window.location.search);
  var reqdParams = ["smid", "email", "epi", "empi", "appname", "du"];
  // Use required params like appname, du etc. to render the form with more information about the user and product to be unsubscribed
  var unsubMap = {
    smid: params.smid,
    mediumvalue: params.email,
    productid: params.epi // If it needs to be specific to the product
  };

swat.unsubscribeFromSwym(unsubMap, function() {
    console.log("Unsubscribed successfully");
  }, function() {
    console.error("Unsubscribe failed");
  });
});
ArgumentTypeDescription
unsubMapobjectObject containing params required to unsubscribe
unsubMap.mediumvalueStringMedium value to unsubscribe
unsubMap.medium
(optional)
stringOptional, Medium to unsubscribe from, Default: email
unsubMap.productid (optional)number/stringVariant id of the product to unsubscribe
unsubMap.smid (optional)guidMessage id to unsubscribe
successCallbackfunctionSuccess callback function which will be called with the response
errorCallbackfunctionError callback function which will be called on unsuccessful response.