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

By General Input

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.

Integrations

  • Gmail
  • AfterShip

Type

Agentic Task

Categories

  • Customer Support
  • Operations

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.

Related prompts

Explore more prompts
Win back LiveChat visitors whose chats went unansweredChase the paperwork every new client and vendor still owesFile Gmail attachments into storage with names you can findCandidate rediscovery desk for your archived Lever applicantsLaytime and demurrage claim workspace for chartering opsKajabi customer support console for member access fixesRun your application review round on Jotform submissionsRun your nutrition clients' weekly meal plans from one consoleReplace the dispatch whiteboard with a live production boardJob search command center with a self-filling pipeline board