Skip to content

The moment it happens

Match refund requests to orders and confirm by email

Each refund request is matched to its WooCommerce order, a note is added to the order, and the customer gets a confirmation email with the order details.

Runs
The moment it happens
Apps
Gmail, WooCommerce
AI
Optional
Access
Woo read/write; gmail.send

Send this to your assistant

Create a ClickRuntime automation: when my helpdesk sends a refund ticket to this link, find the WooCommerce order by order number or email, add a note to it, send the customer a confirmation email with the order details, and tell #support.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

Refund requests arrive as free-text emails: some with an order number, most without. Each one means searching the store, adding a note so the team knows, and writing back to reassure the customer. On a busy week the replies slip, and customers escalate to a chargeback.

Looking up the order and confirming receipt straight away buys time to decide on the refund properly, while the customer knows their request was received.

What you get out of it

  • Customers hear back immediately

    A prompt confirmation with their order details reduces follow-up emails and chargebacks from people who think they were ignored.

  • The order carries the history

    A note on the WooCommerce order shows anyone looking at it that a refund was requested, and when.

  • Less searching

    Staff start with the order already found instead of hunting by email address.

  • The team sees the queue

    A Slack message in #support makes each request visible so it's picked up.

How it works

What happens, step by step

  1. Your helpdesk sends each new refund ticket to your automation's link.

  2. ClickRuntime picks out the order number, or the customer's email address, and finds the order in WooCommerce.

  3. It adds a note to the order saying a refund was requested.

  4. It emails the customer from your Gmail address confirming the request, with the order details.

  5. It posts the request to #support in Slack.

Before it runs live

  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
  • Connect WooCommerce
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Match refund requests to orders and confirm by emailjust nowSucceeded
Slack · #supportRefund request for order #10391 ($64.00) confirmed to customer

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Gmail and WooCommerce steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
handle_refund_requests_with_order_lookup.pyexample
import re, base64
from email.message import EmailMessage
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_event, credentials, http, notify

STORE = "https://shop.example.com/wp-json/wc/v3"

@on_event
def handle(event):
    t = event.json or {}
    email, text = t.get("requester_email", ""), f"{t.get('subject', '')} {t.get('description', '')}"
    num = re.search(r"#(\d{3,})", text)
    auth = (credentials.secret("WOO_KEY"), credentials.secret("WOO_SECRET"))
    orders = http.get(f"{STORE}/orders", auth=auth, params={"include": num.group(1)} if num else {"search": email, "per_page": 1}).json()
    if not orders:
        notify.slack(f"Refund request from {email}: no order found, please check", channel="#support")
        return {"found": False}
    o = orders[0]
    http.post(f"{STORE}/orders/{o['id']}/notes", auth=auth, json={"note": f"Refund requested via ticket {t.get('id')}"})
    items = "\n".join(f"- {li['quantity']} x {li['name']}" for li in o["line_items"])
    msg = EmailMessage()
    msg["To"], msg["Subject"] = o["billing"]["email"], f"We've received your refund request for order #{o['number']}"
    msg.set_content(f"Hi {o['billing']['first_name']},\n\nWe've received your request for order #{o['number']} "
                    f"placed {o['date_created'][:10]}:\n{items}\n\nWe'll get back to you within 2 working days.")
    gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    gmail.users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(msg.as_bytes()).decode()}).execute()
    notify.slack(f"Refund request for order #{o['number']} (${o['total']}) confirmed to customer", channel="#support")
    return {"found": True, "order": o["number"]}

FAQ

Common questions

What does the customer's email say?
That their refund request has been received, with the order number, items and date, and when to expect an answer. It doesn't promise a refund.
Can it read refund requests straight from Gmail?
Yes. Instead of a helpdesk link, it can check a Gmail label every few minutes for new requests.
What if the order can't be found?
No note or email is sent, and #support gets a message to look it up by hand.
What permissions does it need?
Woo read/write; gmail.send. Nothing else in your accounts is used.
Does it need AI?
No, but you can ask for an AI step (for example a summary). It then uses ClickRuntime's built-in AI allowance.
How many runs does it use?
One run for each event the app sends.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Match refund requests to orders and confirm by email” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.