Skip to main content
Run respondReviewWorkflow to attach a store’s answer to a review, for example from a custom vendor route or a support tool. The workflow writes seller_note once and refuses to overwrite an existing answer.

Before you begin

Check which reviews a store may answer before you build on this workflow:
  • Seller reviews only: product reviews have no seller link, so the built-in Vendor API can’t reach them
  • One answer per review: a second call fails until seller_note is cleared
  • No status change: answering leaves status as it is
1

Check that the review belongs to the store

Look up the seller link before you write. The built-in Vendor route runs the same check:
src/api/vendor/review-answers/[id]/helpers.ts
seller_seller_review_review is the link table between sellers and reviews.
2

Run the workflow

Call respondReviewWorkflow with the review id and the answer:
src/api/vendor/review-answers/[id]/route.ts
Mercur fills req.seller_context on /vendor routes with the signed-in member’s current store.

Handle a second answer

respondReviewWorkflow throws in two cases:
  • NOT_FOUND, “Review not found”: no review has this id
  • NOT_ALLOWED, “This review already has a response”: seller_note is already set
The built-in routes return 400 for the second case. If a later step fails after the write, the workflow sets seller_note back to null.

Replace an existing answer

The respond workflow never overwrites. To replace an answer, clear it with updateReviewWorkflow, then respond again:
Import both workflows from @mercurjs/core/workflows. The built-in APIs cap seller_note at 300 characters, while the workflow itself doesn’t.

Next steps