Order tracking
Let the AI agent answer order status and tracking questions from your store platform or any order system.
Order tracking lets the AI agent answer questions such as "Where's my order?", "Has #12345 shipped?" or "What did I order with this email?" on its own. It looks the order up in your system during the conversation, then replies with the status, the items and the tracking link. Order questions are often the largest share of a store's support volume, so this is usually the first thing to automate.
The AI agent gets order data through actions. Store platforms come with ready-made lookup actions, and any other order system works the same way through an action that calls the API you already have.
Store platforms: ready-made lookups
Connecting Shopify, WooCommerce, Magento 2, BigCommerce, Shoptet Premium or PrestaShop adds two order lookup actions to the business:
getOrderDetailsByOrderIdfinds an order by its order number.getOrderDetailsByEmailfinds a customer's orders by email address.
It also adds an Orders panel to the help desk sidebar, so your team sees the same order data next to each conversation. See Order widgets.
To use the lookups, add them to the workflow that handles order questions. Both are editable copies, not a fixed integration. Copilot can change what they return, combine them with your shipping provider's tracking, or require the email used for the order before sharing any details.
Add the order lookups to the workflow that handles order questions. Before sharing any details, check that the email the customer gives matches the order.
On Shopify, an action can read anything the Shopify Admin API exposes. See Shopify custom actions.
Any other order system
Orders that live somewhere else work just as well: an ERP, an order management system, a warehouse system or your own backend. You don't need to build a special endpoint or match any schema. Whatever API you already have for orders is enough, whether it is REST, GraphQL, a partner feed or anything else reachable over HTTPS. A short action wraps it:
- It receives a lookup value from the AI agent, such as an email address, order number or phone number.
- It calls your API the way your API expects, with its own authentication, headers and query parameters.
- It returns the fields you want the AI agent to know about.
The AI agent then uses that data however the conversation needs: a status update, a summary of the items, a tracking link. You control what comes back and can change it at any time without touching your own system. If a back office has no usable API, browser automation can look the order up the way a person would.
Ask Copilot or your own AI agent through Octocom MCP to build it. Describe your order API, and it creates the actions, tests them with real order numbers and adds them to your workflow.
Our orders live in our ERP. The API docs are at https://erp.example.com/api-docs and the key is saved as the secret ERP_API_KEY. Build order lookups by email and by order number, test them with order 58213 and add them to the order status workflow.
Octocom's solution engineers can also review your order API with you and help design multi-step lookups.
One action per lookup type
Instead of one large action with optional filters, use a separate action for each way of looking an order up. It makes it obvious to the AI agent which one applies, and keeps each action simple.
| Action | Argument | Priority | Why |
|---|---|---|---|
getOrdersByEmail | Minimum | Most customers can give you their email. Cover this and you can answer most order questions. | |
getOrderById | orderId | Bonus | Faster, more specific lookup when the customer has their order number handy. |
getOrdersByPhone | phone | Bonus | Useful for phone calls or when customers can't remember which email they used. |
Each action returns the same kind of data, just looked up a different way. The AI agent picks the right one based on what the customer provides.
What to return
The minimum useful fields are the order ID, its status, the customer's email or phone, the items, the total and the currency. High-value extras are the tracking number and tracking link (for "where is it?"), the shipping address (for delivery questions) and the last update time (for status timelines).
Always return a list of orders, even for a lookup that finds one order. It keeps every lookup consistent for the AI agent and your workflows.
To match phone numbers reliably, normalize both the customer's input and the stored value to the full international format before comparing them. For developers, normalize_phone_number does this.
Protect customers' order details
Order details include names and addresses, so decide what a customer must prove before the AI agent shares them. A common rule is to require the order number together with the email or phone number used for the order, and to check that match inside the action rather than only in the workflow's instructions. See Customer authentication.
Return only what the customer is allowed to see. Whatever an action returns, the AI agent can read and may repeat.
Parcel tracking
Some order systems only know that a parcel was handed to a carrier. For supported carriers, such as DHL and USPS, an action can also check the carrier's live tracking, so the AI agent can answer "has it arrived?" with the latest scan. See track_shipment.
For developers and AI agents
The rest of this page is a starting point for a Python action against your own order API. For how Python actions work, declare arguments, connect to workflows and handle errors, see Custom actions.
Suggested return shape
You can return any fields you find useful. This is a reasonable starting point; add, remove or rename fields to match your business.
# Example return from getOrdersByEmail / getOrderById / getOrdersByPhone
[
{
"id": "ORD-12345",
"status": "shipped", # pending | processing | shipped | delivered | cancelled
"created_at": "2024-10-10T14:21:00Z",
"updated_at": "2024-10-11T09:00:00Z",
"customer": {
"email": "jane@example.com",
"phone": "+14151234567",
"name": "Jane Doe",
},
"shipping_address": {
"line1": "123 Main Street",
"city": "San Francisco",
"postal_code": "94103",
"country": "US",
},
"items": [
{
"sku": "ABC123",
"name": "Wireless Earbuds",
"quantity": 1,
"price": 59.99,
},
],
"total": 59.99,
"currency": "USD",
"tracking_number": "1Z999999",
"tracking_url": "https://www.ups.com/track?tracknum=1Z999999",
},
]Skeleton: getOrdersByEmail
import urllib.request, urllib.parse, json
def execute_action(context):
email = context["args"]["email"]
url = "https://api.your-store.com/orders?" + urllib.parse.urlencode({"email": email})
req = urllib.request.Request(url, headers={
"Authorization": "Bearer YOUR_API_KEY",
"Accept": "application/json",
})
with urllib.request.urlopen(req, timeout=10) as resp:
raw_orders = json.loads(resp.read())
# Reshape into whatever you want the bot to see.
return [
{
"id": o["order_number"],
"status": o["fulfillment_status"],
"created_at": o["created_at"],
"customer": {"email": o["email"], "name": o.get("customer_name")},
"items": [
{"name": li["title"], "quantity": li["qty"], "price": li["price"]}
for li in o["line_items"]
],
"total": o["total_price"],
"currency": o["currency"],
"tracking_number": o.get("tracking_number"),
"tracking_url": o.get("tracking_url"),
}
for o in raw_orders
]In a real action, don't write the API key into the code. Store it as an organization secret and read it with get_secret, for example get_secret("ORDERS_API_KEY").
getOrderById and getOrdersByPhone follow the same pattern with a different filter. For phone lookups, normalize the number first with normalize_phone_number.
For store platforms, the order helpers return orders in the platform's own format: Shopify, WooCommerce, Magento, BigCommerce, Shoptet and PrestaShop.