Add a comment to a list

Add comments to list.

❗️

This API may require setup from support before use. Please contact [email protected] to enable this in your store.

swat.addComment

Adds a Comment to a List

📘

Comment APIs are supported only for logged in shoppers. Contact [email protected] to enable this feature on your storefront

Definition

swat.addComment(options, onSuccess, onError)

Example

Here's an example of how you can use this API to add Comment to a List :

// Define the opts
let options = {
	listcomments: [{
		"txt": "This List was used by ",
		"lid": "list-id"
	}]
}
// Define success callback
let onSuccess = function(response) {
	// Executed when a comment is successfully added
	console.log("Successfully added Comments to List", response);
}
// Define error callback
let onError = function(error) {
	// Error is an xhrObject
	console.log("Error while adding Comments to List", error);
}
swat.addComment(options, onSuccess, onError);

API Parameters

ArgumentTypeDescription
optionsobjectAn object with a List Comment Input array
listcommentsarrayAn array of List Comment Input
onSuccessfunctionCalled when the List Comments are successfully added to the List.
onErrorfunctionCalled when there is an error while fetching the List Comments to the List.

Success Response

{
  "listcomments": [
    {
      "cid": "comment-id",
      "txt": "Some new comments",
      "lid": "list-id",
      "cts": 145555555511
    }
  ],
  "listitemcomments": []
}

Other References

List Comment Input

Object containing params required for creating new list comment

let comments = {
  "lid": "list id", 
  "txt": "Comment text",
  "cprops": {} // optional param
};
ArgumentTypeRequiredDescription
lidstringYesUnique id of the List to add Comment
txtstringYesComment content
cpropsobjectoptionalMap of custom fields