# Shopify, Gorgias, Zendesk & AI WISMO Integrations

URL: https://docs.lastscanned.com/wismo-integrations

Because `lastscanned` returns live carrier tracking **synchronously on a single `GET /v1/track/{number}` request**, you can wire it directly into storefront tracking pages, helpdesk HTTP actions, and AI WISMO (*"Where Is My Order?"*) agents without building a webhook database.

## 1. Shopify Storefront & Help Center Embed (`/pages/track-order`)

Create a new page in **Shopify Admin → Online Store → Pages** (for example `/pages/track-order`), switch the editor to **Show HTML (`<>`)**, and paste:

```html
<!-- Ad-free Universal Package Tracking Widget -->
<div data-lastscanned-widget data-height="380">
  <a href="https://lastscanned.com/lookup">Track your package with lastscanned</a>
</div>
<script src="https://lastscanned.com/embed.js" async></script>
```

### Replacing 17TRACK's `externalcall.js` (`window.YQV5`) in Shopify

If your theme currently loads `//www.17track.net/externalcall.js` and calls `YQV5.trackSingle`, change only the script `src` to `https://lastscanned.com/embed.js`. Our built-in `window.YQV5` shim mounts the clean `lastscanned` lookup widget inside your existing `#YQContainer` div with zero ad banners. You can customize height and default carrier in the [Tracking Widget Generator](https://lastscanned.com/tools/tracking-widget-generator).

## 2. Gorgias & Zendesk HTTP Action (Live Ticket Enrichment)

When a shopper opens a *"Where is my package?"* ticket, configure an HTTP Action in **Gorgias (Settings → HTTP Integration)** or **Zendesk (Admin Center → Webhooks / Actions)**:

- **Method**: `GET`
- **URL**: `https://api.lastscanned.com/v1/track/{{ticket.customer.integrations.shopify.orders[0].fulfillments[0].tracking_number}}`
- **Headers**:
  - `Authorization`: `Bearer lsk_live_YOUR_API_KEY`
  - `Accept`: `application/json`

Because `lastscanned` responds with a normalized 7-value `status` (`pre_shipment`, `in_transit`, `out_for_delivery`, `delivered`, `exception`, `expired`, `unknown`), verbatim `statusDescription`, and extracted `message` (such as a secondary USPS or UniUni handoff barcode), your macro or AI agent can immediately answer the customer with the latest scan city and timestamp.

## 3. Vercel AI SDK (`tool()`) for Autonomous WISMO Agents

Give your Next.js or Node.js support agent a synchronous package-tracking tool in 15 lines of TypeScript:

```ts
import { tool } from "ai";
import { z } from "zod";

export const trackPackageTool = tool({
  description:
    "Track a package across 200 global, regional, and cross-border carriers (USPS, UPS, FedEx, DHL, OnTrac, Veho, UniUni, SpeedX, GOFO, OSM, Pitney Bowes, Cainiao, YunExpress, Yanwen).",
  parameters: z.object({
    trackingNumber: z.string().describe("The package tracking number"),
    carrier: z
      .string()
      .optional()
      .describe("Optional carrier slug override (e.g. osm or pitneybowes for 92... USPS consolidator barcodes)"),
  }),
  execute: async ({ trackingNumber, carrier }) => {
    const url = new URL(`https://api.lastscanned.com/v1/track/${encodeURIComponent(trackingNumber)}`);
    if (carrier) url.searchParams.set("carrier", carrier);
    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.LASTSCANNED_API_KEY}` },
    });
    return res.json();
  },
});
```

Or skip custom tool definitions altogether and point any MCP-compatible agent runtime at our hosted remote Streamable HTTP MCP server: [`https://mcp.lastscanned.com`](https://lastscanned.com/tools/mcp-config-generator).

## 4. Handling `926129…` / `927489…` Consolidator Blind Spots Automatically

If your fulfillment warehouse or 3PL ships via **OSM Worldwide**, **Pitney Bowes**, **DHL eCommerce**, or **UPS Mail Innovations** using shared `92…` USPS barcodes, query both legs in a single batch call so your customer never stares at *"Shipping Label Created, USPS Currently Awaiting Package"* for 5 days:

```ts
// Query USPS and OSM Worldwide in parallel when USPS returns pre_shipment on a 92... barcode
const uspsRes = await fetch(`https://api.lastscanned.com/v1/track/${num}`, {
  headers: { Authorization: `Bearer ${process.env.LASTSCANNED_API_KEY}` },
}).then((r) => r.json());

if (uspsRes.status === "pre_shipment" && /^9[23]\d{18,24}$/.test(num)) {
  const osmRes = await fetch(`https://api.lastscanned.com/v1/track/${num}?carrier=osm`, {
    headers: { Authorization: `Bearer ${process.env.LASTSCANNED_API_KEY}` },
  }).then((r) => r.json());
  if (osmRes.events?.length > 0) return osmRes;
}
```
