Skip to content

Account API (orders)

With an account API, signed-in customers can ask about their own orders. The assistant lists them and shows order cards with status, items, total and tracking.

In Settings → Signed-in visitors (or PATCH /v1/admin/tenant { account }):

Field Default Meaning
enabled false Turns on the guest/signed-in behaviour
webhookUrl — The store’s account API (https; http://localhost is allowed for development)
loginUrl — Where the widget’s Sign in button goes. https, or a site-relative path such as /account/login?redirect={returnPath}.
showGuestBanner true Show the sign-in bar to guests
timeoutMs 5000 500–10,000

{returnUrl} in loginUrl becomes the current page’s absolute URL, and {returnPath} its path and query (for logins that only accept relative redirects). A relative loginUrl opens on whichever allowed website the chat runs on, so one account can serve both your live and staging store.

Offered only when account.enabled, account.webhookUrl and the visitor’s ext claim are all present:

  • listMyOrders { limit 1–10 (default 5), status? } returns compact JSON per order: orderNumber, status, placedAt, total, currency, itemCount.
  • showOrder { orderNumber } shows an orderCard (part tool-showOrder), or explains that no such order exists for this customer.

The server POSTs JSON to webhookUrl, signed like every webhook (signing):

{
"tenantId": "…",
"conversationId": "…",
"event": "account.orders.list",
"input": { "limit": 5, "status": "shipped" },
"visitor": { "visitorId": "customer-42", "externalUserId": "42", "channel": "web" }
}
Event Input Respond with
account.orders.list { limit, status? } { "orders": [Order, …] }, newest first
account.orders.get { orderNumber } { "order": Order } or { "order": null }
type Order = {
orderNumber: string; // ≤ 64
status: string; // ≤ 60, shown as is
placedAt?: string; // ≤ 40, e.g. "2026-10-06"
total?: number;
currency?: string; // ISO 4217, 3 letters
trackingUrl?: string; // https
items?: { title: string; quantity?: number; price?: number; imageUrl?: string }[]; // ≤ 20
};

Orders that do not match the shape are dropped. A timeout, an error status or invalid JSON makes the assistant apologise and offer a human.

Verify every request as described in Webhook signing.