If your store has an order API, or you can add one endpoint to your backend, your voice agent can read orders during a call. You add a custom HTTP function: the agent calls it when a customer asks about an order, and reads out what it returns.
This works for Magento / Adobe Commerce, BigCommerce, Wix, Dukaan, OpenCart, PrestaShop and custom-built stores. WooCommerce has its own step-by-step guide.
How it works#
- The caller says "where is my order 4473?".
- The agent calls your function with
order_id = 4473. - Your endpoint returns the order's status, items and tracking.
- The agent reads it back in one or two sentences, in the caller's language.
The request goes from the Edesy voice runtime to your endpoint. Your API keys stay in the credential vault and never appear in the prompt.
Step 1: Have an order endpoint#
Using your platform's API. Point the function at the platform's own order endpoint:
| Platform | How the function reads an order | Credential |
|---|---|---|
| Magento / Adobe Commerce | GET/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=increment_id&searchCriteria[filter_groups][0][filters][0][value]={{order_number}} (the order number customers see; GET/rest/V1/orders/{id} takes the internal entity ID) |
Integration access token |
| BigCommerce | GEThttps://api.bigcommerce.com/stores/<hash>/v2/orders/{{order_id}} |
API account token in X-Auth-Token |
| Ecwid | GEThttps://app.ecwid.com/api/v3/<storeId>/orders/{{order_id}}, tracking number in the same response |
Custom app secret_token as Authorization: Bearer (paid plans) |
| Wix | POSThttps://www.wixapis.com/ecom/v1/orders/search with a filter on the order number; tracking via GET/ecom/v1/fulfillments/orders/{orderId} |
API key as Authorization, plus a wix-site-id header |
| PrestaShop | GEThttps://<shop>/api/orders/{{order_id}}?output_format=JSON&display=full; tracking from /api/order_carriers |
Webservice key as HTTP Basic auth (key as username, no password) |
| Squarespace | Orders API reads by internal ID only, so use your own lookup endpoint (below) | Developer API key, Bearer + User-Agent (Commerce Advanced) |
| Zoho Commerce | Sales orders by number, email or mobile, but OAuth tokens expire hourly, so put a token-refreshing endpoint in front | Zoho OAuth (Self Client) |
| OpenCart, Dukaan and others | Your own endpoint (below); Dukaan also has a seller API documented in a Postman collection | Your endpoint's secret |
Per-platform pages: Wix, Ecwid, Squarespace, PrestaShop, OpenCart, Dukaan, Zoho Commerce, Magento, BigCommerce.
Using your own backend. Add one read-only endpoint. Keep the response small; the agent only needs what it will say:
GET https://api.yourstore.com/voice/order-status?order_id=4473&phone=+919876543210
Authorization: Bearer <your token>
{
"found": true,
"status": "shipped",
"items": ["Round bottle applicator (pack of 2)"],
"expected_delivery": "2026-12-04",
"courier": "Delhivery",
"tracking_url": "https://track.example.com/AWB123"
}
Return {"found": false} when there's no match. The agent then asks the caller to check the number.
Step 2: Store your key in the credential vault#
Open Credentials in your agent's Tools tab and add your token, for example as order_api. You'll reference it as {{vault.order_api}}. See Credential Vault.
Step 3: Add the custom function#
Open your agent → Tools → Custom Functions and create a function:
| Field | Example |
|---|---|
| Function Name | get_order_status |
| Description | Look up an order when the customer asks where their order is. Needs the order number. The agent uses this text to decide when to call the function, so say exactly when |
| Method | GET |
| URL | https://api.yourstore.com/voice/order-status?order_id={{order_id}}&phone={{call.phone_number}} |
| Headers | Authorization = Bearer {{vault.order_api}} |
| Parameters | order_id (string, required): "The order number the customer gives" |
| Response Mapping | {"status": "status", "delivery": "expected_delivery", "courier": "courier"} |
Click Test with a real order number before you save.
Response mapping keeps only the fields you list, so the agent isn't distracted by the rest of the payload. Paths use dots, and array items use their index, for example line_items.0.name.
Use the caller's number#
Every function call can use details of the live call:
| Placeholder | Value |
|---|---|
{{call.phone_number}} (also {{call.from}}) |
The customer's phone number on this call |
{{call.id}} |
The call's ID in your Edesy workspace |
{{call.sid}} |
The telephony provider's call ID |
Each request also carries an X-Call-Id header with the call's ID, so your logs can match a lookup to a call.
Sending {{call.phone_number}} lets your endpoint return only orders placed with the caller's number. That's the simplest way to stop one customer hearing another's order.
Step 4: Tell the agent how to use it#
Add a few lines to the agent's prompt:
When a customer asks about an order, ask for the order number, then call get_order_status.
Read the status and expected delivery in one short sentence. Offer the courier and tracking link if shipped.
If the order isn't found, ask them to check the number once, then offer to connect them to the team.
For cancellations, address changes, returns or refunds, don't promise anything: transfer the call to the team.
Step 5: Test#
Use the Test Center to call the agent, ask for a real order, and check the reply. Then assign a phone number and go live.
Call customers when an order changes#
To call customers when an order is placed, shipped or fails delivery, and get the result back in your systems, see Order events and outcomes.
Code samples#
A minimal order-status endpoint in three languages. Each checks a bearer token, finds the order, and returns only what the agent needs.
Node.js (Express)
app.get("/voice/order-status", async (req, res) => {
if (req.get("Authorization") !== `Bearer ${process.env.VOICE_TOKEN}`) return res.sendStatus(401);
const order = await db.orders.findOne({ number: req.query.order_id, phone: req.query.phone });
if (!order) return res.json({ found: false });
res.json({ found: true, status: order.status, items: order.items.map(i => i.name),
expected_delivery: order.eta, courier: order.courier, tracking_url: order.trackingUrl });
});
PHP
<?php
if (($_SERVER['HTTP_AUTHORIZATION'] ?? '') !== 'Bearer ' . getenv('VOICE_TOKEN')) { http_response_code(401); exit; }
$order = find_order($_GET['order_id'] ?? '', $_GET['phone'] ?? '');
header('Content-Type: application/json');
echo json_encode($order ? [
'found' => true, 'status' => $order['status'], 'items' => array_column($order['items'], 'name'),
'expected_delivery' => $order['eta'], 'courier' => $order['courier'], 'tracking_url' => $order['tracking_url'],
] : ['found' => false]);
Python (FastAPI)
@app.get("/voice/order-status")
def order_status(order_id: str, phone: str = "", authorization: str = Header("")):
if authorization != f"Bearer {os.environ['VOICE_TOKEN']}":
raise HTTPException(401)
order = find_order(order_id, phone)
if not order:
return {"found": False}
return {"found": True, "status": order.status, "items": [i.name for i in order.items],
"expected_delivery": order.eta, "courier": order.courier, "tracking_url": order.tracking_url}
Need help?#
Tell us your store platform and we'll help you set it up.