Quick Overview
This workflow receives product reviews via a webhook and uses an OpenAI-compatible Chat Completions API to draft an on-brand public reply in JSON, returning the reply plus token usage and an estimated cost, with a single corrective retry when the model output is invalid.
How it works
- Receives a POST webhook request containing review details like rating, text, product, reviewer_first_name, and an optional review_id.
- Loads configuration such as the system prompt, brand voice, model name, base URL, temperature, and per-token pricing.
- Calls an OpenAI-compatible /chat/completions endpoint to generate a JSON object with reply, tone, and publish_ready.
- Validates the model response by parsing the returned content as JSON and checking it includes the required keys.
- If the output is invalid or the API errors, sends one corrective follow-up request to the same LLM endpoint and validates the retried response.
- Responds to the webhook with either the reply draft (including usage, attempt count, and estimated cost) or a needs_human=true result when the output remains invalid.
Setup
- Create an HTTP Header Auth credential with name Authorization and value Bearer YOUR_API_KEY, and select it for both LLM HTTP requests.
- Update the LLM base URL and model name in the configuration step to match your OpenAI-compatible provider.
- (Optional) Adjust the system prompt, brand_voice, temperature, and input/output token prices to fit your policy and cost model.
- Activate the workflow and send review JSON to the POST webhook endpoint at /webhook/review-reply-drafter.