Tell the team when a tracking number is added

Notice and team email with the carrier and tracking number. A validated order.tracking_added@1 definition.

When someone adds a tracking number to an order, or buys a shipping label, tell the team at once with the order number, the carrier and the number. Trigger: order.tracking_added@1. Actions: notify_me@1 and send_internal_email@1.

This is the tracking moment, not the shipped moment. A shipping label writes the tracking number before the carrier has the parcel and before the order's status becomes shipped. For the shipped moment use order.fulfilled@1.

Model background: Automations.

The definition

{
  "schemaVersion": 1,
  "trigger": {
    "type": "order.tracking_added@1",
    "origins": [
      "USER",
      "API",
      "MCP",
      "ASSISTANT",
      "BULK",
      "IMPORT",
      "DUPLICATE",
      "SYSTEM",
      "AUTOMATION"
    ]
  },
  "steps": [
    {
      "id": "tell",
      "type": "action",
      "contract": "notify_me@1",
      "input": {
        "title": "Tracking added to order {{order.number}}",
        "message": "{{shipment.carrier}} {{shipment.trackingNumber}}. This is the moment a tracking number was added, for example when a label is bought. It does not mean the parcel has shipped."
      }
    },
    {
      "id": "mail",
      "type": "action",
      "contract": "send_internal_email@1",
      "input": {
        "recipientUserIds": ["user_REPLACE_WITH_TEAM_MEMBER_ID"],
        "subject": "Tracking added to order {{order.number}}",
        "body": "A tracking number was added to order {{order.number}}. Carrier: {{shipment.carrier}}. Tracking number: {{shipment.trackingNumber}}. The parcel may not have shipped yet.",
        "includeEntityLink": true
      }
    }
  ]
}

Replace user_REPLACE_WITH_TEAM_MEMBER_ID with the id of a team member (1 to 5 user ids, never an email address). The notice goes to the people who manage automations in the dashboard; the email goes only to the people you name.

How it works

  • order.tracking_added@1 fires once per new non-empty tracking number of an order, in the transaction that writes it. That happens when an order is shipped with a tracking number (Fulfill), when a number is added or corrected on an order that already shipped, when a shipping label is bought, and, only for a number the order has not had before, when cancelling a shipment makes another live shipment's number the order's number (a number fires once per order and counts when its label is bought, so this is rare: it happens for a label bought before the automation was switched on).
  • Its facts are the order facts without the status transition, plus event.facts.shipment.carrier (text, may be empty) and event.facts.shipment.trackingNumber. No tracking link is ever a fact, because some carrier links contain a postal code.
  • A text may use the order variables, {{shipment.carrier}} and {{shipment.trackingNumber}}. The tracking number is personal data (a parcel id can identify a recipient at the carrier), so print it only into your own notices, emails and HTTP bodies and a filter or a condition on it is refused (FILTER_PATH_INVALID). Filter on event.facts.shipment.carrier instead (the dashboard form offers only the carrier).
  • To alert on one carrier only, add a trigger filter with { "op": "all", "rules": [{ "path": "event.facts.shipment.carrier", "op": "eq", "value": "UPS" }] }.
  • Events come from the dashboard, the API and the carrier pipeline (USER, API, SYSTEM). An MCP or assistant fulfilment records USER, as order.fulfilled@1 does.

What it does not do

  • It is not "the order was shipped". order.fulfilled@1 is the shipped moment, once per order. A label purchase fires this trigger earlier. To act only once the order is really shipped, use order.fulfilled@1, or add a wait and then a condition on current.order.status being SHIPPED, DELIVERED, FULFILLED or COMPLETED.
  • It does not fire when the same number is written again, when the tracking is cleared, when an order is created or imported with a tracking number, for a return label, or for a correction back to a number already recorded for that order. Changing A to B and back to A records A once.
  • It does not email the shopper a shipping update. The platform already emails the customer when an order ships, so a send_customer_email@1 under this trigger would be a second email, never the shipped email. A marketing email goes only to a customer who agreed to marketing emails; an email about the order carries no offers.
  • The recipients of the team email must still be allowed to receive it at send time, or the run ends SKIPPED with NO_RECIPIENTS.

Create it

With the Admin MCP:

  1. get_automation_guide with topic: "triggers", then "messages".
  2. validate_automation_definition. Fix every finding.
  3. test_automation with entity: { "type": "Order", "id": "<an order id>" }. The test uses the order's current tracking number, or the example number SAMPLE-TRACKING when it has none, and nothing is saved or sent.
  4. create_automation_draft with name: "Tracking number added".
  5. Tell the merchant to approve it in the dashboard.

With the SDK:

const check = await admin.validateAutomationDefinition(storeId, { definition });
if (!check.ok) throw new Error(JSON.stringify(check.errors));

const draft = await admin.createAutomation(storeId, {
  name: 'Tracking number added',
  definition,
});

What the merchant sees

A draft in Settings, then Automations. Once on, each new tracking number on an order sends a notice in the dashboard and an email to the people you chose, for example "Tracking added to order 1042" with the carrier, the number and a link to the order. The history shows one row per new number.