createReview( )
Creates a review.
Description
The createReview()
function returns a promise that resolves to the created review.
This function requires a contactId
.
If the review author does not have a contact ID, use createReviewAndContact()
.
If authorName
is left empty, the member's name will be used. If the author is not a member, the field is left null
.
Syntax
function createReview(review: Review): Promise<Review>
createReview Parameters
NAME
TYPE
DESCRIPTION
Review data.
Returns
Created review.
Return Type:
NAME
TYPE
DESCRIPTION
Date and time the review was created.
Review ID.
Date and time the review was updated.
Author of the review.
Review content.
ID of the entity to review. For example, a Wix Stores product ID.
Number of site visitors who found the review helpful.
Number of site visitors who found the review unhelpful.
Helpfulness score.
Calculated by subtracting foundUnhelpful
from foundHelpful
.
Moderation status of the review.
Review namespace. Currently integrated with Wix Stores, as stores
.
Provides information about the origin of the review. Organic reviews are created by site visitors or members. App reviews are created by apps even though a site visitor or member is the author of the review. Apps can not create or update organic reviews.
Reply to the review.
Date and time then review was written. It should the same time as created_date except for reviews that were imported from the other review system.
Revision number, which increments by 1 each time the review is updated. To prevent conflicting changes, the current revision must be passed when updating the review. Ignored when creating a review.
Indicates whether the review has been verified through a Verify Product Purchase call to the Review Product catalog SPI.
Was this helpful?
createReview example
1import { reviews } from 'wix-reviews.v2';23 async function createReview(review) {4 try {5 const result = await reviews.createReview(review);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13