Skip to content

Webhook ​

This page explains how to subscribe to Webhooks so the system proactively pushes events to you when an order starts picking, ships, has a tracking update, or is canceled, and when inbound receiving is complete, and how to verify the signature of each push.

How to Register ​

You can register in either of two ways:

  • Register on the OMS page: OMS → System (系统) → Open API (开放API对接) → "Webhooks" card → Add webhook. Fill in "Callback URL", choose "Events" (leave blank for all events), set "Enabled", and Save. In the list you can Edit, Reset secret, and Delete, and view the "Last push" result.
  • Register through the API: see the endpoints below.

Endpoints at a Glance ​

MethodPathPurposescope
POST/open-api/v1/oms/webhooksRegister or update a subscriptionoms:write
GET/open-api/v1/oms/webhooksList subscriptionsoms:read
DELETE/open-api/v1/oms/webhooks/{id}Delete a subscriptionoms:write

All accept only customer Keys.

Register / Update a Subscription ​

POST /open-api/v1/oms/webhooks

FieldTypeRequiredDescription
idlongNoIf provided, updates the existing subscription; if omitted, creates a new one
urlstringYesCallback URL; must start with http:// or https://; https is strongly recommended
eventsstringNoSubscribed events, comma-separated; omitted or * = all
secretstringNoSigning secret. When creating, if omitted the system generates one (starting with whsec_); when updating, if omitted the original is kept, and if provided it is replaced
enabledintNo1 enabled (default when creating) / 0 disabled
remarkstringNoRemark
bash
curl -X POST https://api.vmwms.com/open-api/v1/oms/webhooks \
  -H "x-api-key: <YOUR_API_KEY>.<YOUR_API_SECRET>" -H "Content-Type: application/json" \
  -d '{"url":"https://erp.example.com/vmwms/hook","events":"order.shipped,order.cancelled,order.tracking,inbound.received"}'
json
{
  "code": 200,
  "msg": "Webhook 订阅已注册,请立即保存签名密钥(仅显示一次)",
  "data": {
    "id": "1800000000000000041",
    "url": "https://erp.example.com/vmwms/hook",
    "events": "order.shipped,order.cancelled,order.tracking,inbound.received",
    "hasSecret": true,
    "secret": "whsec_<EXAMPLE_ONLY>",
    "enabled": 1,
    "remark": null,
    "lastPushTime": null,
    "lastPushResult": null
  }
}

The msg above means "Webhook subscription registered. Save the signing secret now (shown only once)".

The signing secret is returned only once

The plaintext secret is returned only once, when the subscription is created. On update, secret is returned as null and msg is "Webhook subscription saved" (Webhook 订阅已保存). Save it immediately.

List Subscriptions ​

GET /open-api/v1/oms/webhooks

data is an array, and secret is always null (only hasSecret is given). lastPushResult looks like SUCCESS http=200 try=1/3 or FAILED http=500 try=3/3; use it to check whether your callback is working.

Delete a Subscription ​

DELETE /open-api/v1/oms/webhooks/{id}. On success msg is "Deleted" (已删除). If the subscription does not exist or does not belong to you, the message is "Webhook does not exist or does not belong to the current customer" (Webhook 不存在或不属于当前货主).

Event Types ​

EventWhen it firesMain fields
order.pickingAn outbound order enters Picking for the first timeoutboundNo, externalOrderNo, status, statusText "Picking" (拣货中), carrier
order.shippedAn outbound order has fully shippedoutboundNo, externalOrderNo, status, statusText "Shipped" (已出库), carrier, trackingNo
order.trackingThe shipment tracking changedoutboundNo, externalOrderNo, carrier, trackingNo, data:{trackCode, lastEvent, nodeCount, trackDate}
order.cancelledAn outbound order was canceled and its inventory releasedoutboundNo, externalOrderNo, status, statusText "Cancelled" (已取消)
order.exceptionFulfillment exception (currently: a cancel request for an already-shipped order was rejected)outboundNo, externalOrderNo, statusText "Fulfillment exception" (履约异常), data:{reason}
inbound.receivedReceiving for an inbound order is completestatus, statusText "Received" (已收货), data:{inboundNo, packingNo, warehouseId, items:[{skuCode, receivedQty, expectedQty}]}

Note: when a dropship order in Draft status is canceled, it is simply voided, and order.cancelled is not pushed.

Push Format ​

  • Method: POST <your callback URL>, Content-Type: application/json;charset=UTF-8.
  • Timeout: 8 seconds.
  • Retries: on a non-2xx response or a network error, the push is retried, up to 3 attempts in total (about 2 seconds and 5 seconds apart), after which it is abandoned. The result is recorded in lastPushResult.
  • Every enabled Webhook under the same account that subscribes to the event receives the push.

Request headers:

HeaderDescription
X-Wms-EventThe event type, such as order.shipped
X-Wms-SignatureThe signature: the lowercase hexadecimal of HMAC-SHA256(raw request body, signing secret)

Request body example:

json
{
  "event": "order.shipped",
  "timestamp": "2026-12-03 16:20:00",
  "customerId": "1800000000000000001",
  "outboundOrderId": "1800000000000000031",
  "outboundNo": "<WMS_OUTBOUND_NO>",
  "externalOrderNo": "PO-TEST-0001",
  "status": 4,
  "statusText": "已出库",
  "carrier": "UPS",
  "trackingNo": "1Z999AA10123456784",
  "data": null
}
json
{
  "event": "inbound.received",
  "timestamp": "2026-12-20 15:00:00",
  "customerId": "1800000000000000001",
  "outboundOrderId": null,
  "outboundNo": null,
  "externalOrderNo": null,
  "status": 3,
  "statusText": "已收货",
  "carrier": null,
  "trackingNo": null,
  "data": {
    "inboundNo": "REVDEMO2612030001",
    "packingNo": "TEST1234567",
    "warehouseId": "1800000000000000101",
    "items": [ { "skuCode": "SKU-A001", "receivedQty": "498", "expectedQty": "500" } ]
  }
}
  • externalOrderNo: the platform order number if there is one, otherwise the customer order number.
  • Fields with a null value are also output; large-integer IDs and quantities are strings.

Signature Verification ​

Compute the signature over the raw request body bytes you received. Do not parse it into an object and re-serialize it (changes in field order or whitespace will make the signature mismatch). Use a constant-time comparison.

Python (Flask) ​

python
import hmac, hashlib
from flask import Flask, request, abort

app = Flask(__name__)
WEBHOOK_SECRET = "<YOUR_WEBHOOK_SECRET>"


def verify(raw_body: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode("utf-8"), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature or "")


@app.post("/vmwms/hook")
def hook():
    raw = request.get_data()  # raw bytes
    if not verify(raw, request.headers.get("X-Wms-Signature"), WEBHOOK_SECRET):
        abort(401)
    event = request.headers.get("X-Wms-Event")
    payload = request.get_json()
    # Put it on a queue for asynchronous processing and return 2xx as soon as possible
    print(event, payload.get("externalOrderNo"), payload.get("trackingNo"))
    return "ok"

Node.js (Express) ​

javascript
const express = require('express');
const crypto = require('crypto');

const app = express();
const WEBHOOK_SECRET = process.env.VMWMS_WEBHOOK_SECRET;

function verify(rawBody, signature, secret) {
  const expected = crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
  return typeof signature === 'string' && expected.length === signature.length &&
    crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}

// Use the raw parser to get the raw bytes
app.post('/vmwms/hook', express.raw({ type: 'application/json' }), (req, res) => {
  if (!verify(req.body, req.get('X-Wms-Signature'), WEBHOOK_SECRET)) {
    return res.status(401).end();
  }
  const event = req.get('X-Wms-Event');
  const payload = JSON.parse(req.body.toString('utf8'));
  console.log(event, payload.externalOrderNo, payload.trackingNo);
  res.status(200).send('ok');
});

app.listen(3000);

Java ​

java
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;

public final class WebhookVerifier {
    public static boolean verify(byte[] rawBody, String signature, String secret) throws Exception {
        if (signature == null) return false;
        Mac mac = Mac.getInstance("HmacSHA256");
        mac.init(new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
        byte[] digest = mac.doFinal(rawBody);
        StringBuilder hex = new StringBuilder();
        for (byte b : digest) hex.append(String.format("%02x", b));
        return MessageDigest.isEqual(hex.toString().getBytes(StandardCharsets.UTF_8),
                                     signature.getBytes(StandardCharsets.UTF_8));
    }
}

Best Practices for the Receiver ​

  1. Return 2xx within 8 seconds, and move slow processing to an asynchronous queue.
  2. De-duplicate by event + outboundNo / inboundNo + timestamp; retries can cause duplicate deliveries.
  3. After 3 failed attempts a push is not re-sent, so keep scheduled queries as a fallback (for example, pull unfinished orders hourly).
  4. Use https for the callback URL, and verify the signature before processing.

FAQ ​

Why am I not receiving Webhook pushes? ​

Check in order: whether the subscription is "Enabled"; whether "Events" includes the event (blank means all); whether the callback URL is reachable from the public internet and its certificate is valid; and the "Last push" result in the OMS "Webhooks" list. FAILED http=xxx means your service returned an error.

Signature verification always fails ​

The most common cause is computing the signature over JSON that was parsed and then re-serialized. Use the raw request body bytes. Also confirm you are using that Webhook's signing secret, not the API Secret.

I lost the signing secret. What now? ​

In the OMS "Webhooks" list, click Reset secret, or pass a new secret when updating the subscription through the API. After a reset the old secret stops working immediately, so update your system accordingly.

I received the same event twice ​

Retries after a failed push can cause duplicate deliveries. De-duplicate using event type + document number + timestamp.