# Connect Any Online Store

> Connect Magento, BigCommerce, Wix, a custom-built store or any platform with an order API to your AI voice agent. Add a custom HTTP function so the agent reads order status during the call, with the caller's number sent automatically.

Source: https://edesy.in/docs/voice-agent/store-integrations/custom-store

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](https://edesy.in/docs/voice-agent/store-integrations/woocommerce).

## How it works

1. The caller says "where is my order 4473?".
2. The agent calls your function with `order_id = 4473`.
3. Your endpoint returns the order's status, items and tracking.
4. 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](https://edesy.in/docs/voice-agent/tools/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 | `GET https://api.bigcommerce.com/stores/<hash>/v2/orders/{{order_id}}` | API account token in `X-Auth-Token` |
| Ecwid | `GET https://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 | `POST https://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 | `GET https://<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](https://edesy.in/ai-voice-agent/integrations/wix), [Ecwid](https://edesy.in/ai-voice-agent/integrations/ecwid), [Squarespace](https://edesy.in/ai-voice-agent/integrations/squarespace), [PrestaShop](https://edesy.in/ai-voice-agent/integrations/prestashop), [OpenCart](https://edesy.in/ai-voice-agent/integrations/opencart), [Dukaan](https://edesy.in/ai-voice-agent/integrations/dukaan), [Zoho Commerce](https://edesy.in/ai-voice-agent/integrations/zoho-commerce), [Magento](https://edesy.in/ai-voice-agent/integrations/magento), [BigCommerce](https://edesy.in/ai-voice-agent/integrations/bigcommerce).

**Using your own backend.** Add one read-only endpoint. Keep the response small; the agent only needs what it will say:

```http
GET https://api.yourstore.com/voice/order-status?order_id=4473&phone=+919876543210
Authorization: Bearer <your token>
```

```json
{
  "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](https://edesy.in/docs/voice-agent/tools/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:

```text
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](https://edesy.in/docs/voice-agent/store-integrations/order-events).

## 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)**

```javascript
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
<?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)**

```python
@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](https://edesy.in/ai-voice-agent/integrations/any-online-store) and we'll help you set it up.
