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

TypeScript
clearCache(): void

Invalidates 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

TypeScript
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

slugOrId

string

The URL slug (e.g. 'excellent-service') or numeric ID<br> (as string, e.g. '42') of the review

Returns: Promise<Review>

TypeScript
const review = await lynkow.reviews.getBySlug('excellent-service')
console.log(review.rating)   // 5
console.log(review.content)  // "Best experience ever!"

list

TypeScript
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

filters

ReviewsFilters

Optional filters to narrow down results:<br> - page / limit — pagination (defaults to page 1)<br> - minRating / maxRating — filter by rating range (1-5 scale)<br> - sort / order — sort field and direction ('asc' or 'desc')

options

BaseRequestOptions

Base request options (locale override, custom fetch options)

Returns: Promise<ReviewsListResponse>

TypeScript
// 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

TypeScript
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>

TypeScript
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

TypeScript
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

data

ReviewSubmitData

The review data to submit:<br> - authorName — reviewer's display name (required)<br> - authorEmail — reviewer's email (required if settings demand it)<br> - rating — numeric rating (must be within the site's min/max range, typically 1-5)<br> - title — optional review title (required if settings demand it)<br> - content — the review text (required)

options

SubmitOptions & BaseRequestOptions

Optional submission options:<br> - recaptchaToken — the reCAPTCHA v3 token if reCAPTCHA is enabled<br> - fetchOptions — custom fetch options (e.g. AbortSignal)

Returns: Promise<ReviewSubmitResponse>

TypeScript
const result = await lynkow.reviews.submit({
  authorName: 'Alice',
  rating: 5,
  content: 'Excellent service!'
})

if (result.status === 'pending') {
  // Show "your review is awaiting moderation"
}