Share on social media

Share a link on social media such as facebook, twitter..etc that leads to your wishlist.


This API creates the unique URL for a particular sharing platform and opens a new dialog in that platform to perform the sharing step. For eg., for facebook, the share page will be opened in a new window.


swat.shareListSocial(lid, fromName, platformShareUrlTemplate, platform, note, 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.


let lid = "" // List ID you wish to share.
let fromName = "Name of the sharer";
let platformShareUrlTemplate = "{{shareurl}}&t={{note}}"; // this is specific to platform, please look up your platform.
let platform = "facebook" // name of the platform
let note = "Note you want to add to share" // Optional note.

let onError = function(error) {
  // Error is an xhrObject
	console.log("There was an Error opening the share platform", error);

swat.shareListSocial(lid, fromName, platformShareUrlTemplate, platform, note, onError);

API Parameters

lidguidList id to share. Pass null if multiple lists is not enabled
fromNamestringSharer's name for reporting
platformShareUrlTemplatestringThe social platform-specific share URL with Mustache tags. Out of the box, platforms supported are "facebook", "twitter". To get share urls for these, use the variable - swat.retailerSettings.Wishlist.SharingModes. This has the default icon url, share url and key for each of these platforms. Again, new platforms can be added here and/or default icons can be changed for you if you need
platformstringThe key to one of the sharing platforms. By default, one of "facebook", "twitter"
notestringSome platforms allow to send a custom note along with shared url. This field is to capture that message. Amongst the defaults, at the moment, notes only work with twitter.
onErrorfunctionFunction that gets called if there is an error. Called with error message as argument.