Log daily Loop returns to Sheets and flag big refunds
Every morning at 6am, yesterday's Loop returns land in your spreadsheet, and any refund above your limit opens a support ticket for a human.
Every morning at 6am, pull the previous 24 hours of returns from Loop Returns, append one row per return to a Google Sheets log, and open a Gorgias ticket for any return whose refund is above a threshold I set. Every step here is a fixed field mapping plus one threshold check, so build it as a deterministic code workflow rather than an agent.
Trigger: a cron schedule, once a day at 6am in my local timezone. Loop Returns is not available as a polling source on this platform, so cron plus a list call inside the workflow is the right shape.
Step one, fetch the returns. Call the Loop Returns Detailed Returns List operation with no from or to values, because that endpoint already defaults to the previous 24 hours, which lines up exactly with a daily 6am run. Pass paginate=true and a pageSize of 250 so a busy day is not truncated (the default page size is 100 and the max is 750), then keep following nextPageUrl until it comes back null. Loop allows 300 requests per minute per API key and returns a 429 when you exceed it, so pause briefly and retry rather than failing the run.
Step two, normalize each return into a row. Loop reports money as a MoneySet, an integer amount in minor units plus a currency code, so divide the refund amount by 100 before writing it and keep the currency code in its own column. Collapse the line items into a single readable cell, for example: 2 x Merino Crew Sweater, 1 x Wool Socks. Where a return has different reasons across its items, join the distinct reasons with a comma. The columns, in order, are: Return ID, Order Name, Customer Email, Items, Return Reason, Refund Amount, Currency, Status.
Step three, write the rows. Use the Google Sheets Append Values operation to append the whole day's rows in a single call to the returns log tab, below the existing header row rather than overwriting it. Use valueInputOption USER_ENTERED so refund amounts land as numbers rather than text. If there were no returns in the window, write nothing and finish cleanly.
Step four, flag the high-value refunds. Define the threshold as an editable constant at the top of the workflow, expressed in major units (default it to 200), not buried inside a node, so I can change it without touching the logic. For every return whose converted refund amount is at or above that threshold, call the Gorgias Create Ticket operation. Use a subject in the form: High-value return: {order name} ({refund amount} {currency}). The body should restate the return id, order name, customer email, items, return reason, refund amount and currency, and the current return status, then close with a line asking the assigned agent to reach out to the shopper personally before the refund lands. Create the ticket with an internal note message so nothing is emailed to the shopper automatically, and set the ticket customer to the shopper's email so it threads onto their existing Gorgias record.
Gorgias rate limits API key integrations to 40 requests per 20 second window and sends back a Retry-After header when you cross it, so space out ticket creation on a heavy day instead of firing them all at once.
Keep the Loop return id in the first column so that if I ever re-run the workflow by hand, duplicate rows are obvious and easy to clean up.
Example output
What does this prompt do?
- Runs every morning at 6am and collects every return your shoppers created in the last 24 hours.
- Adds one row per return to your Google Sheets log, covering the return, the order, the shopper's email, the items coming back, the reason, the refund amount and currency, and where the return stands right now.
- Opens a Gorgias ticket for any refund above the amount you set, so someone reaches out personally before the money goes back.
- Works through the whole day's returns rather than stopping at the first batch, so a busy Monday is captured in full.
What do I need to use this?
- A Loop Returns account you can connect, with permission to read your returns.
- A Google account and a spreadsheet with a tab for the log and a header row across the top.
- A Gorgias helpdesk your support team already works out of.
- A refund amount you consider high value, so the workflow knows when a person should step in.
How can I customize it?
- Change the run time, or run it twice a day during peak returns season.
- Raise or lower the high-value refund amount as your average order value changes. It is a single setting at the top of the workflow.
- Adjust the columns in the log, or point the workflow at a different tab or spreadsheet.
- Reword the support ticket, or add tags so high-value returns are easy to filter in Gorgias.
FAQs
Does this email my customer when a high-value return comes in?
What happens on a really busy returns day?
Can I change what counts as a high-value refund?
Does it handle more than one currency?
Do I need my store connected as well as Loop?
What if there were no returns yesterday?
Related templates
Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.
Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.
Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.
Keep a spreadsheet of your most important senders, and every email from one gets labeled, posted to your team channel, and logged automatically.
The moment an order is fulfilled, we register it with Yotpo so the review request is timed off real delivery, and we log every sync so failures never go unnoticed.
Every night at 11pm we compare the day's Shopify orders with your Zoho Books invoices and payments, and flag only what does not match.
Stop copying returns into a spreadsheet by hand.
Get a returns log that fills itself every morning, and a support ticket the moment a big refund needs a human.