Service for retrieving and submitting customer reviews.
Accessible via lynkow.reviews. Only reviews with status 'approved'
are returned by the public API. New submissions go through moderation
if requireApproval is enabled in the review settings. Anti-spam
honeypot fields are injected automatically on submissions. Responses
are cached for 5 minutes (SHORT TTL).
Access via: lynkow.reviews
Methods
5 methods
clearCache
clearCache(): voidInvalidates all cached review responses (lists, individual reviews, and settings).
This is called automatically after a successful submit(), but can also be
called manually if needed.
Returns: void
getBySlug
getBySlug(slugOrId: string): Promise<Review>Retrieves a single approved review by its slug or numeric ID. Returns the full review including any owner response. Cached for 5 minutes.
Parameter | Type | Description |
|---|---|---|
|
| The URL slug (e.g. |
Returns: Promise<Review>
const review = await lynkow.reviews.getBySlug('excellent-service')
console.log(review.rating) // 5
console.log(review.content) // "Best experience ever!"list
list(filters?: ReviewsFilters, options?: BaseRequestOptions): Promise<ReviewsListResponse>Retrieves a paginated list of approved customer reviews. Only reviews that have passed moderation are returned. Cached for 5 minutes per unique filter combination.
Parameter | Type | Description |
|---|---|---|
|
| Optional filters to narrow down results:<br> - |
|
| Base request options (locale override, custom fetch options) |
Returns: Promise<ReviewsListResponse>
// Fetch top-rated reviews (4+ stars)
const { data, meta } = await lynkow.reviews.list({
minRating: 4,
limit: 10
})
data.forEach(review => {
console.log(`${review.authorName}: ${review.rating}/5`)
if (review.response) {
console.log(`Owner reply: ${review.response.content}`)
}
})settings
settings(): Promise<ReviewSettings>Retrieves the public review settings for this site, including whether reviews are enabled, moderation rules, rating scale, and field configuration. Use this to dynamically render the review submission form. Cached for 10 minutes.
Returns: Promise<ReviewSettings>
const settings = await lynkow.reviews.settings()
if (!settings.enabled) {
// Reviews are disabled, hide the form
return
}
if (settings.fields.email.required) {
// Render email field as required
}submit
submit(data: ReviewSubmitData, options?: SubmitOptions & BaseRequestOptions): Promise<ReviewSubmitResponse>Submits a new customer review. Anti-spam honeypot fields (_hp, _ts) are
injected automatically by the SDK. If reCAPTCHA is enabled on the site, pass
the token via options.recaptchaToken. After a successful submission, the
reviews cache is automatically invalidated.
Parameter | Type | Description |
|---|---|---|
|
| The review data to submit:<br> - |
|
| Optional submission options:<br> - |
Returns: Promise<ReviewSubmitResponse>
const result = await lynkow.reviews.submit({
authorName: 'Alice',
rating: 5,
content: 'Excellent service!'
})
if (result.status === 'pending') {
// Show "your review is awaiting moderation"
}