API Reference

Email Wishlist

Send an email of the wishlist contents to an email address.

swat.sendListViaEmail

Sends an email with the wishlist contents of the current user to a given email id.

Definition

swat.sendListViaEmail(params, onSuccess, onError)

❗️

This API is only supported for Logged in Users.

The user must have a valid source email address, which is picked up implicitly by the API. The user must be logged in to use this functionality.

Example

// List ID You wish to email. 
let lid = "";

// information required to send the email
let params = {
	toEmailId: "[email protected]", // To Email
	fromName: "ABC XYZ", // From Name 
	note: "Hey, check out these products!",  // Note 
	lid: lid, // null when multiple list is not enabled
	cprops: {}, // custom props for the share, future usage
}

// Success Callback.
let onSuccess = function(response) {
	console.log("Successfully sent the wishlist contents via Email", response)
}

// Error Callback.
let onError = function(error) {
  // Error is an xhrObject
	console.log("There was an Error Sending the email", error);
}

// Send API 
swat.sendListViaEmail(params, onSuccess, onError);

API Parameters

Argument

Type

Description

params.lid

guid

list id of the list you wish to share.

params.toEmailId

string

An email Id to send the wihlist to

params.fromName

string

The sender's name

params.note

string

Some personal note that needs to be sent along with the email contents

params.cprops
(optional)

object

Reserved for future

onSuccess

function

A callback function which takes a single argument (JSON response from the swym service)

onError

function

A callback function that gets called if the send failed

Success Response

{
    "listinfo": {
        "di": "c3feba7e-c0e0-47cb-be5e-5c32e688fa84",
        "listcontents": [
            {
                "di": "c3feba7e-c0e0-47cb-be5e-5c32e688fa84",
                "bt": "Swym Marketing",
                "dt": "Circle Pink Basin with Gold Rim",
                "cts": 1679570465816,
                "empi": 7096233230534,
                "sku": "23",
                "cby": null,
                "lid": "9f63f7b3-2db4-42ae-bf8b-d728484cad60",
                "du": "https://demo.swym.it/products/circle-pink-basin-with-gold-rim?variant=41254658539718",
                "pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
                "epi": 41254658539718,
                "id": "4faa55ca-0c17-409b-aa55-ca0c17809bdf",
                "uts": 1679570465816,
                "_pkey": "c3feba7e",
                "iu": "https://cdn.shopify.com/s/files/1/0534/3635/0662/products/CirclePinkBasinwithGoldRim_620x620.jpg?v=1637582971",
                "_t": 2,
                "uby": null,
                "pr": 300.0
            },
            {
                "di": "c3feba7e-c0e0-47cb-be5e-5c32e688fa84",
                "bt": "Swym Marketing",
                "dt": "Circle Basin White",
                "cts": 1679570438391,
                "empi": 7096232476870,
                "sku": "23",
                "cby": null,
                "lid": "9f63f7b3-2db4-42ae-bf8b-d728484cad60",
                "du": "https://demo.swym.it/products/circle-basin-white?variant=41254657360070",
                "pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
                "epi": 41254657360070,
                "id": "a6a1541a-f546-4c77-a154-1af5464c776e",
                "uts": 1679570438391,
                "_pkey": "c3feba7e",
                "iu": "https://cdn.shopify.com/s/files/1/0534/3635/0662/products/CircleBasinWhite_620x620.jpg?v=1637582937",
                "_t": 2,
                "uby": null,
                "pr": 300.0
            },
            {
                "di": "c3feba7e-c0e0-47cb-be5e-5c32e688fa84",
                "bt": "Swym Demo",
                "dt": "Striped Bag",
                "cts": 1666196721008,
                "empi": 6575309390022,
                "cby": null,
                "lid": "9f63f7b3-2db4-42ae-bf8b-d728484cad60",
                "du": "https://demo.swym.it/products/copy-of-peaks-design-bag?variant=39413927182534",
                "pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
                "epi": 39413927182534,
                "id": "24300d50-cdbd-4de4-b00d-50cdbd6de473",
                "uts": 1679313702035,
                "_pkey": "c3feba7e",
                "iu": "https://cdn.shopify.com/s/files/1/0534/3635/0662/products/smartmockups_kh4gut7l_620x620.jpg?v=1616077965",
                "_t": 2,
                "uby": null,
                "pr": 17.0,
                "vi": "Black"
            }
        ],
        "userinfo": null,
        "lty": "wl",
        "cts": 1666196720652,
        "anonRead": 1,
        "cnt": 3,
        "lname": "My Wishlist",
        "cby": null,
        "lid": "9f63f7b3-2db4-42ae-bf8b-d728484cad60",
        "pid": "KABSbuGyYCuM6/IV7e7cGxT1978LieU1jRdMt6XhYfo=",
        "st": 1,
        "id": "b7ffab8f-6f40-41ca-bfab-8f6f40d1ca5c",
        "uts": 1680008865557,
        "_pkey": "c3feba7e",
        "_t": 1,
        "itemcmnts": 0,
        "uby": null,
        "lhash": "bXktd2lzaGxpc3Q="
    },
    "msg": "List emailed successfully."
}
📘

The template we send is the default Wishlist Share Template; if you want to customize it, this may be a fee-based endeavour.