API Reference

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");
  });
});

Argument

Type

Description

unsubMap

object

Object containing params required to unsubscribe

unsubMap.mediumvalue

String

Medium value to unsubscribe

unsubMap.medium
(optional)

string

Optional, Medium to unsubscribe from, Default: email

unsubMap.productid (optional)

number/string

Variant id of the product to unsubscribe

unsubMap.smid (optional)

guid

Message id to unsubscribe

successCallback

function

Success callback function which will be called with the response

errorCallback

function

Error callback function which will be called on unsuccessful response.