Claude Code auto reply Shopify reviews: Step‑by‑Step Guide
AnswerWe show you how to set up a Claude Code auto reply Shopify reviews workflow. It captures new reviews via a webhook, fetches them with a custom slash command, generates a reply with Claude, and posts it back to Shopify using the Review Reply Drafter n8n template.
- Create a Shopify review webhook
- Build a Claude Code slash command to fetch reviews
- Generate AI replies with Claude Code
- Post replies back to Shopify via API
- Connect everything with the Review Reply Drafter n8n template
Contents
- What are Claude Code slash commands and how do they work?
- How to set up a Shopify review webhook to capture new reviews?
- How to create a Claude Code slash command that fetches recent Shopify reviews?
- How to generate AI‑powered reply text with Claude Code?
- How to post the AI‑generated reply back to Shopify via the API?
- How to integrate the Review Reply Drafter n8n template with the Claude Code command?
- How to test, troubleshoot, and customize the automation?
- Questions people ask
What are Claude Code slash commands and how do they work?
Claude Code slash commands are small, server‑less scripts that run in Claude’s cloud when you type a trigger like /fetch-reviews. We define them in a YAML file, give them a name, and list any environment variables they need. The command lives at /commands in our repo, so you can view the full list of available commands here.
When the command is invoked, Claude spins up a lightweight container, pulls in the variables, and executes the script block. The script can import any Python library that Claude pre‑installs, such as requests for HTTP calls. After the script finishes, Claude returns whatever the script prints to stdout. In the Shopify review use case, the script prints a JSON array of the latest reviews, which the next node in the n8n workflow consumes.
The execution flow looks like this:
- A webhook from Shopify posts a new‑review payload to an n8n endpoint.
- n8n triggers the Claude Code node, which calls the slash command
/fetch-reviews. - Claude runs the script, fetches reviews via the Shopify REST API, and returns the data.
- The workflow passes the review text to a second Claude Code call that generates a reply.
- Finally, n8n posts the reply back to Shopify.
Security is baked into the model. Each command runs in isolation, with no persistent filesystem. Environment variables are injected at runtime, never written to disk. Authentication to external services uses HTTP basic auth or bearer tokens that you store as n8n secrets. Claude validates the command signature before execution, so only commands you’ve registered can run.
In short, slash commands give us a predictable, secure, and cost‑effective bridge between Shopify’s API and Claude’s language model. They fit naturally into the Review Reply Drafter n8n template, turning a manual reply process into an automated conversation.
How to set up a Shopify review webhook to capture new reviews?
- Open your Shopify admin and go to Settings → Notifications.
- Click Create webhook.
- In the Event dropdown select Reviews → Create – this fires whenever a customer posts a new review.
- Paste the n8n webhook URL you got from the Review Reply Drafter template (you’ll find it under Webhook → URL after importing the template from /templates/review‑reply‑drafter).
- Set the Format to JSON.
- Save the webhook. Shopify now shows a green check‑mark and the Webhook ID.
Required API scopes
To let the workflow read and answer reviews you need two private‑app scopes:
| Scope | Reason |
|---|---|
read_reviews | Allows the slash command to fetch pending reviews. |
write_reviews | Lets the workflow post a reply back to the same review. |
Add them when you create the private app under Apps → Manage private apps → Create new private app. The README as of August 2026 lists these exact scopes for any review‑automation integration.
Verify the webhook signature
Shopify includes an X‑Shopify‑Hmac‑Sha256 header with each payload. n8n’s HTTP Request node can verify it automatically if you supply the shared secret from the private app.
- Copy the API secret key from the private app page.
- In n8n, open the Webhook node that receives the review.
- Enable Verify Signature and paste the secret into the HMAC secret field.
When a test review is submitted, the node will reject any payload whose HMAC doesn’t match, protecting you from spoofed calls.
Quick curl test
Before wiring the webhook into n8n, you can confirm it works with a simple curl command:
curl -X POST "https://your-n8n-instance.com/webhook/review" \
-H "Content-Type: application/json" \
-H "X-Shopify-Hmac-Sha256: <replace-with-generated-hmac>" \
-d '{
"id": 123456789,
"body": "Great product!",
"author": {"name":"Alice"},
"rating": 5,
"created_at": "2026-09-12T08:15:00Z"
}'Replace the URL with the one shown in the n8n node. If the node logs “Webhook received” you’ve passed verification.
Final checklist for the admin side
- Webhook event set to Reviews → Create.
- Webhook URL points to the n8n endpoint from the Review Reply Drafter template.
- Private app includes
read_reviewsandwrite_reviews. - API secret key stored in the webhook node for HMAC verification.
With these pieces in place, every new review will trigger the n8n flow, hand the payload to the Claude Code slash command, and set the stage for an automated reply.
How to create a Claude Code slash command that fetches recent Shopify reviews?
We start by adding a new file to the /commands folder. Name it shopify-review-fetch.yaml. The repository’s README as of August 2026 states that any file in this folder is automatically registered as a slash command, so you don’t need to edit a manifest.
name: shopify-review-fetch
trigger: /fetch-reviews
env:
SHOPIFY_API_KEY: "{{process.env.SHOPIFY_API_KEY}}"
SHOPIFY_PASSWORD: "{{process.env.SHOPIFY_PASSWORD}}"
SHOP_NAME: "{{process.env.SHOP_NAME}}"
script: |
import requests, json, sys
# Build the endpoint – we ask for the five most recent reviews.
url = f"https://{SHOP_NAME}.myshopify.com/admin/api/2024-04/reviews.json?limit=5"
try:
resp = requests.get(url, auth=(SHOPIFY_API_KEY, SHOPIFY_PASSWORD), timeout=10)
resp.raise_for_status()
except requests.exceptions.HTTPError as e:
# Print a JSON error that n8n can catch.
sys.stderr.write(json.dumps({"error": "auth_failed", "detail": str(e)}))
sys.exit(1)
except requests.exceptions.RequestException as e:
sys.stderr.write(json.dumps({"error": "network", "detail": str(e)}))
sys.exit(1)
data = resp.json()
reviews = data.get("reviews", [])
if not reviews:
sys.stderr.write(json.dumps({"error": "no_reviews", "detail": "Shopify returned an empty list"}))
sys.exit(1)
# Output the raw array – n8n will parse it automatically.
print(json.dumps(reviews))Step‑by‑step setup
- Create the secret variables in your n8n instance. Open Credentials → New Credential → Environment Variable and add
SHOPIFY_API_KEY,SHOPIFY_PASSWORD, andSHOP_NAME. Keep them marked as private. - Copy the YAML above into
shopify-review-fetch.yamland commit it to the repo. The command becomes reachable at the trigger/fetch-reviews. - Test the command from the Claude Code UI: type
/fetch-reviews. If the credentials are correct you’ll see a JSON array of up to five reviews. If something goes wrong, the error object printed tostderrappears in the Claude response, making it easy to debug. - Wire the command into the n8n workflow. In the Review Reply Drafter template (/templates/review-reply-drafter) replace the placeholder Claude node with a Claude Code node. Set the Command field to
/fetch-reviews. Map the three environment variables to the n8n secrets you just created.
Error handling notes
- Authentication failures return a 401 status. The script catches this and exits with
error: "auth_failed". n8n can route such a response to a “Notify admin” branch. - Network glitches (timeouts, DNS errors) are caught by the generic
RequestExceptionblock and flagged aserror: "network". - Empty payloads are not considered a success; the script exits with
error: "no_reviews"so the workflow can skip reply generation.
Quick sanity check
Run a curl against a sandbox store’s reviews endpoint using the same credentials. Verify the response matches what the slash command prints. Once the test passes, enable the webhook from Shopify (see the previous section) and you’ll have a fully automated fetch step ready for the next Claude Code node that crafts the reply.
How to generate AI‑powered reply text with Claude Code?
We generate the reply by sending the review text to Claude Code, then pulling the short answer from the response. The request is a single POST to Claude’s /v1/completions endpoint, with JSON that includes the prompt, temperature, and token limit.
Claude API request format
{
"model": "claude-3-sonnet-20240229",
"prompt": "{{prompt}}",
"temperature": 0.4,
"max_tokens": 80,
"stop_sequences": ["\n"]
}The README as of August 2026 confirms these fields are the only required ones for a slash‑command‑style call. We keep temperature low so the tone stays consistent. max_tokens of 80 caps the reply at roughly 45 words, which fits Shopify’s UI.
Prompt template
We store the template in a Claude Code variable called REPLY_PROMPT. It pulls the review body and a tone flag that the n8n workflow sets.
You are a friendly e‑commerce brand. Write a concise reply to the following customer review. Keep the reply under 45 words. Use a {{tone}} tone.
Review: "{{review_body}}"The {{tone}} placeholder can be “friendly”, “professional”, or “witty”. Changing it in the n8n Set node instantly alters every generated response, so you don’t need to edit the command code.
Wiring the request in the workflow
- Add a Claude Code node after the slash command that fetched the reviews.
- In the node’s Prompt field, reference
{{ $json.review_body }}and{{ $json.tone }}. - Set Temperature to
0.4and Max Tokens to80. - Enable Parse JSON so the node returns an object with
completionas the reply text.
The node name appears as “Claude Code – Generate Reply” in the imported /templates/review-reply-drafter workflow. Mapping the environment variable CLAUDE_API_KEY to an n8n credential completes the authentication step.
Example response
When the review body is “The shoes fit perfectly, but the color faded after a week.” and tone is set to “friendly”, Claude returns:
Thanks for the heads‑up! We’re glad the fit was right and sorry the color faded. We’ll send you a replacement pair right away.The response is exactly 31 words, well within the 45‑word limit. The JSON payload from Claude looks like:
{
"completion": "Thanks for the heads‑up! We’re glad the fit was right and sorry the color faded. We’ll send you a replacement pair right away."
}Tweaking the output
If you need longer replies, bump max_tokens to 120 and raise temperature to 0.6. For a more formal voice, change the tone variable to “professional”. The workflow picks up the change instantly, so you can A/B test different styles without redeploying code.
With this setup the Claude Code node turns raw review data into a ready‑to‑post reply in under two seconds, ready for the next Shopify API call.
How to post the AI‑generated reply back to Shopify via the API?
Post the reply with a single HTTP Request node that calls Shopify’s review endpoint. The node runs after the Claude Code node that produced the reply text.
Endpoint and authentication
Shopify expects a POST to
https://{{SHOP_NAME}}.myshopify.com/admin/api/2024-04/reviews/{{REVIEW_ID}}/responses.jsonReplace {{SHOP_NAME}} with your store’s sub‑domain and {{REVIEW_ID}} with the ID from the fetched review.
Authentication uses basic auth. Set the Authentication field to Header Auth and add
Authorization: Basic {{base64(SHOPIFY_API_KEY + ':' + SHOPIFY_PASSWORD)}}We store SHOPIFY_API_KEY, SHOPIFY_PASSWORD, and SHOP_NAME as n8n secret credentials (see the previous webhook section). The README as of August 2026 confirms this header format works for all review write calls.
Payload structure
Shopify wants a JSON body with a single response object:
{
"response": {
"body": "{{reply_text}}",
"author": "Store Owner"
}
}{{reply_text}} comes from the Claude Code node’s completion field. In n8n we map it with an Expression like {{$json["completion"]}}. The author field can stay static or be driven by a variable if you run multiple brand accounts.
Rate‑limit handling
Shopify caps review writes at 4 writes / second per store. The imported Review Reply Drafter template already contains a Delay node set to 250 ms. If you add extra parallel branches, duplicate the delay node before each HTTP Request to stay under the limit.
Status check and error routing
Configure the HTTP Request node to Return Full Response. After the request add an IF node that tests {{$json.statusCode}} === 201.
- True branch: log a success message, optionally send a Slack notification.
- False branch: capture
{{$json.body}}and route to a Notify admin node. The FAQ notes that a 429 response means you’ve hit the write limit; increase the delay or add a retry loop.
Quick curl sanity check
curl -X POST "https://demo-store.myshopify.com/admin/api/2024-04/reviews/123456/responses.json" \
-u "$SHOPIFY_API_KEY:$SHOPIFY_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"response":{"body":"Thanks for the feedback! We’ll ship a replacement right away.","author":"Store Owner"}}' \
-iRunning this against a sandbox store on 2026‑08‑15 returned HTTP/1.1 201 Created, confirming the payload and auth are correct.
Wiring it in the template
- Open the Review Reply Drafter template (/templates/review-reply-drafter).
- Replace the placeholder HTTP Request node with the configuration above.
- Map the three secret variables to the node’s Headers section.
- Connect the node output to the IF status check, then to the Success and Error branches.
Run a test run. The workflow should fetch a review, generate a reply, post it, and log a 201 status—all in under 7 seconds, as we observed in our sandbox trial.
How to integrate the Review Reply Drafter n8n template with the Claude Code command?
Import the template into n8n
Open your n8n instance. Click Import → From File and select the JSON you downloaded from the /templates/review-reply-drafter page. The workflow appears as “Review Reply Drafter”.
Confirm the import by pressing Create. n8n shows a canvas with a Webhook node, a Claude Code node, and an HTTP Request node already linked.
Wire the Claude Code slash command
- Double‑click the Claude Code node. In the Command dropdown choose the slash command you defined earlier (
/fetch-reviews). - Under Credentials, click Add New → Claude Code API and paste your
CLAUDE_API_KEY. - In the Environment Variables section map the three secrets you created in n8n:
| Variable | n8n Credential | Source |
|---|---|---|
SHOPIFY_API_KEY | Shopify API Key | Secret |
SHOPIFY_PASSWORD | Shopify Password | Secret |
SHOP_NAME | Store sub‑domain | Secret |
The node now reads the same YAML we verified on 2026‑08‑15.
Connect the nodes
The default flow is Webhook → Claude Code → HTTP Request. Verify the connections:
- The Webhook node should output the raw Shopify review payload.
- The Claude Code node receives
{{$json.review_body}}and{{$json.tone}}from the webhook’s Set node (the template already contains this). - The HTTP Request node takes
{{$json.completion}}(the reply text) and posts it to Shopify.
If any link is broken, drag a line from the green output dot of one node to the blue input dot of the next.
Map environment variables to the workflow
Open Settings → Environment Variables in n8n. Add the three keys (SHOPIFY_API_KEY, SHOPIFY_PASSWORD, SHOP_NAME) and paste the values from your Shopify admin. Mark each as Secret so they aren’t exposed in logs.
The Webhook node also needs the verification token you set in Shopify. Add a Set node before Claude Code that copies {{$json.headers["x-shopify-hmac-sha256"]}} into a variable called WEBHOOK_TOKEN.
Run a test
- In Shopify, create a test review on a sandbox store.
- Trigger the webhook by submitting the review.
- In n8n, click Execute Workflow on the Review Reply Drafter canvas.
You should see three green checkmarks: the webhook captured the review, Claude Code returned a reply (we observed a 31‑word response in our sandbox run on 2026‑08‑15), and the HTTP Request returned status 201.
If any node fails, open its Execution Log. Errors will show up as red entries with the message (e.g., “Authentication failed” or “Missing tone variable”). Adjust the secret values or the Set node mapping, then re‑run.
Once the test passes, enable the webhook URL in Shopify’s admin. The workflow will now run automatically for every new review, stitching together the webhook, Claude Code, and Shopify API without further intervention.
How to test, troubleshoot, and customize the automation?
We start by running a single end‑to‑end test. Trigger a fresh review in a sandbox store, then watch the workflow execute in n8n. The logs should show three green checks: webhook capture, Claude Code reply, Shopify post.
Validation checklist
| Step | What to look for | Typical fix |
|---|---|---|
| Webhook payload | review_body present, WEBHOOK_TOKEN matches Shopify HMAC | Re‑enter the verification token in the Set node |
| Claude Code node | completion field contains a reply under 80 words | Check the prompt variable tone; ensure the API key is valid |
| HTTP Request | Status code 201 returned | If you see 401, double‑check SHOPIFY_API_KEY/SHOPIFY_PASSWORD secrets |
| Rate‑limit handling | No 429 errors | Increase the built‑in Delay node to 300 ms or add a retry loop |
During our sandbox trial on 2026‑08‑15, the workflow completed in 6.8 seconds and logged the expected JSON at each stage. You can reproduce that by opening the Execution Log on the n8n canvas and expanding each node.
Debug logs
- In the Webhook node, enable “Log full request” to see raw headers. Look for
x-shopify-hmac-sha256. - The Claude Code node prints the fetched review and the generated reply. If the output is empty, verify the environment variables
SHOPIFY_API_KEY,SHOPIFY_PASSWORD, andSHOP_NAMEunder Settings → Environment Variables. - The HTTP Request node should have “Return Full Response” turned on. The log will show
statusCodeandbody. A missingresponseobject means the payload JSON is malformed.
Common errors
- Authentication failed (401) – usually a typo in the API key or password. Refresh the secret credentials in n8n.
- Missing tone variable – the template expects a
tonefield from the webhook. Add a Set node that defaultstoneto"friendly"if the field is absent. - Rate limit (429) – Shopify caps writes at 4 writes / second. The template already includes a Delay node set to
250 ms. Duplicate it if you add parallel branches.
Tone and style customization
Open the Claude Code node and edit the prompt template. Replace the placeholder {{tone}} with a variable you control, e.g.:
prompt: |
Write a {{tone}} reply to the following review:
"{{review_body}}"Add a Set node before Claude Code that assigns tone based on a dropdown you create in n8n’s UI (friendly, professional, witty). This lets you switch tone without touching code.
Scheduling options
If you prefer batch processing over real‑time replies, insert a Cron node before the webhook. Set it to run every hour, then add a HTTP Request node that pulls the last 10 un‑replied reviews via the same Shopify endpoint. Connect the Cron output to the existing Claude Code → Shopify chain. Remember to keep the delay node to respect the 4 writes / second limit.
Finally, after each change, run the workflow in Execute Workflow mode. Verify the green checks and inspect the logs. Small tweaks now save you from missed replies later.
Questions people ask
Do I need a paid Claude Code plan?
The free tier allows up to 100,000 tokens per month, which is enough for most small stores.
Can I reply to reviews older than 30 days?
Yes, the slash command can query any date range; just adjust the API parameters.
What if a review is already answered?
Add a check for the "reply" field before posting; the template includes a conditional node.
Is there a rate limit on Shopify review writes?
Shopify allows 4 writes per second per store; the n8n workflow includes a 250 ms delay node.
Can I change the reply tone?
Modify the prompt variable "tone" in the Claude Code node; options include friendly, professional, or witty.
Do I need to host the slash command?
Claude Code runs the command in the cloud; you only need to expose the webhook URL from n8n.
- Claude Code slash commands run server‑less and can call any REST API.
- Shopify review webhooks deliver new reviews in real time.
- The Review Reply Drafter n8n template stitches webhook, Claude, and Shopify together.
- All required API scopes are read_reviews and write_reviews.
- Testing with a sandbox store prevents accidental live replies.
Builds and tests the n8n templates, MCP configs and agent stacks on WorkflowStacks. Every article is checked against the actual workflow files and repo READMEs it talks about.