Daily post-purchase review request emails for Shopify

By General Input

Every morning, email customers who got their Shopify order seven days ago and ask for a review, with safe retries and a quiet list for opted-out shoppers.

Integrations

  • Shopify
  • Resend

Type

Deterministic Code

Categories

  • Marketing
  • Operations

Build a deterministic code workflow that runs a daily post-purchase review request email blast for my Shopify store, sent through Resend.

Trigger: cron, every day at 10:00 in my store's local time zone.

Step 1 — pull the eligible orders from Shopify. Call Shopify's List Orders with filters financial_status=paid and fulfillment_status=fulfilled, and a 24-hour window on updated_at that lands exactly seven days ago (use the configured lookback window, default 7 days, from now in the store time zone). Paginate via the Link header until all matching orders are pulled (max 250 per page).

Step 2 — filter the orders before sending. Drop any order whose customer carries one of the excluded customer tags (default: no-marketing) — read the comma-separated tags string on the customer object. Also drop any order that has been refunded since fulfillment (any refund with a created_at after the fulfillment's created_at, or financial_status of refunded / partially_refunded covering the line items).

Step 3 — build the email payload. For each remaining order, build one entry: to = customer email, from = the configured verified Resend sender, subject = the configured subject template, html = the configured HTML body template. Interpolate {{first_name}} from customer.first_name, {{order_number}} from order.name (or order.order_number), {{product_title}} from the first line item's title, and {{product_image}} from the first line item's product image URL (look up via the product's images if not on the line item directly). Skip orders with no customer email.

Step 4 — send via Resend's Send Batch Emails endpoint. Batch in groups of up to 100 entries per call and paginate calls as needed. On every batch send, set an Idempotency-Key header derived from the Shopify order IDs in that batch (for example, a stable hash of the sorted order ID list, or one batch per order with key = `review-request-{order_id}` if you want per-order idempotency) so a retry never double-sends. Respect Resend's 2 req/sec send limit and back off on 429 using the retry-after header.

Step 5 — log a summary at the end: how many orders matched, how many were filtered out and why (opted-out tag, refunded), how many emails were attempted, how many Resend accepted, and any errors with the failing order ID.

Expose these as workflow inputs so the operator can edit them without touching code: lookback_days (default 7), resend_from (verified-domain From address, e.g. "Acme Reviews <reviews@acme.com>"), subject_template (default "How are you liking your {{product_title}}?"), html_body_template (default a simple branded HTML body that greets {{first_name}}, references order {{order_number}}, embeds {{product_image}}, and includes a call-to-action link), and excluded_customer_tags (default ["no-marketing"]). The HTML body template should be editable as a single string.

Authentication: use the existing Shopify connection (shop domain + admin access token) and the existing Resend connection (API key). Do not invent new credentials. Keep the flow deterministic — no LLM steps. Use Shopify REST Admin API version 2026-01.

Related prompts

Explore more prompts
Receiving dock console for inspecting and restocking Loop returnsSee which influencer creators actually drove Shopify salesMorning dispatch board for your local delivery runsAnswer Instagram and Messenger DMs with the order on screenWhite glove queue for the VIP customers waiting on youReturns and warranty claim desk that follows your policyFraud lookup desk for any email, phone, IP address or linkReview high risk Shopify orders before anything gets pickedFraud review desk for the Shopify orders you should holdMorning repricing console for Shopify with margin-safe rules