# Auto-reply to "where's my order?" emails with live tracking

> When a customer emails a tracking number to your support inbox, we look it up in AfterShip and reply with the live status, location, and expected delivery.

- Workflow type: agent
- Services: Gmail, AfterShip
- Categories: Customer Support, Operations
- Published: 2026-07-17

## What it does

- Watches a dedicated Gmail label for inbound customer shipping questions so it never touches unrelated email
- Reads each message, pulls the tracking number out of the body, and figures out which carrier it belongs to
- Fetches the latest checkpoint and predicted delivery window from AfterShip
- Sends a warm, plain-English reply on the same thread naming where the package is, its current status, and when it's expected
- If the tracking number is missing or the carrier is ambiguous, asks the customer for the missing detail instead of guessing

## What you'll need

- A Gmail account and a dedicated label (for example 'shipping/support' or 'tracking-questions') that inbound customer shipping questions route to
- An AfterShip account that covers the couriers you ship with

## Prompt

Poll a dedicated Gmail label (for example 'shipping/support' or 'tracking-questions') for new incoming emails so this only fires on customer shipping questions, never on the rest of the inbox. For each new email that lands in that label, do the following as an agent.

Step 1. Call Gmail Get a Message with the incoming message id and format=full. Pull out the sender's name and email, the subject, the thread id, and the plain-text body.

Step 2. Read the body and extract the tracking number. It may be labelled ('Tracking:', 'order tracking number is...'), embedded in a URL, or bare. Also note any carrier name the customer mentions (UPS, FedEx, USPS, DHL, Royal Mail, etc.) — that hint helps resolve ambiguity later. If no tracking number is present in the email, skip straight to the fallback reply in step 6.

Step 3. Call AfterShip Detect Courier with the extracted tracking number. If it returns exactly one courier, use that slug. If it returns more than one and the customer named a carrier in their email, pick the courier whose name matches. If it returns nothing, or more than one with no hint from the customer, skip to the fallback reply in step 6.

Step 4. Try AfterShip Get Tracking by ID first in case we've already registered this tracking (search AfterShip for the tracking number if you need the id). If we don't have it yet, call AfterShip Create Tracking with the tracking number plus the detected courier slug so AfterShip starts tracking the shipment. Read the checkpoints array, the current tag/status, and the expected_delivery field from the response.

Step 5. Draft a plain-language reply that names where the package is right now (the city, state, or country from the latest checkpoint), the current status in customer-facing language (in transit, out for delivery, delivered, held at customs, delivery exception, etc.), and the expected delivery window. Keep it warm and short. No jargon, no raw status codes, no internal ids.

Step 6. Send the reply with Gmail Reply to a Message on the same thread id so the conversation stays intact. If the tracking number was missing, reply asking the customer to send it. If the courier was ambiguous, reply asking the customer to confirm which carrier they shipped with (UPS, FedEx, USPS, DHL, etc.). If Get Tracking or Create Tracking fails for any other reason, reply acknowledging the email and letting the customer know a teammate will follow up shortly.

The workflow should be safe to run automatically end-to-end — no human touches the thread unless a fallback branch triggers a follow-up ask.

## How to customize

- Change which Gmail label the workflow watches so it lines up with your existing support routing
- Tune the tone, greeting, and signature of the reply to match your brand voice
- Adjust the fallback message that goes out when the tracking number is missing or the carrier can't be identified

## FAQ

### What if the customer forgets to include a tracking number?

The workflow spots the missing number and sends a friendly reply asking the customer to share it, so nothing falls through the cracks.

### Do I really need a dedicated Gmail label?

Yes — that's how the workflow knows which emails to touch. Route inbound 'where's my order?' emails to a label like 'shipping/support' or 'tracking-questions' using Gmail's filters, and the workflow only fires on messages that land there.

### What happens when the carrier can't be figured out from the tracking number?

If AfterShip returns more than one possible carrier and the customer's email doesn't hint at which one, the reply asks the customer to confirm the carrier (UPS, FedEx, USPS, DHL, and so on) instead of guessing.

### Will the reply stay in the same email thread?

Yes. Replies go out threaded, so the customer sees a continuous conversation and your team's existing filters and views still work.

### Which shipping carriers does this support?

AfterShip covers more than a thousand couriers worldwide, so any tracking number your customers send in should resolve as long as that carrier is enabled on your AfterShip account.

Use this prompt in General Input: https://www.generalinput.com/prompts/auto-reply-to-wheres-my-order-emails-with-live-tracking