Outbound Webhook
Outbound status changes are pushed by webhook. Both subscription-based delivery (multiple events, multiple URLs) and the per-order dedicated URL registered through webhook_url at submission are supported. Both use HMAC-SHA256 signing and a 5-second timeout. Delivery runs asynchronously through an outbox, and both subscription-based and dedicated URLs retry with exponential backoff (up to 5 attempts).
Events
| Event | Trigger |
|---|---|
outbound.created | Outbound order created |
outbound.approved | Approval passed / auto-approved |
outbound.warehouse_confirmed | Warehouse confirmed and locked inventory |
outbound.rejected | Approval rejected |
outbound.stock_ready | Warehouse marked stock ready |
outbound.shipped | Carrier picked up / dispatched |
outbound.completed | Delivery completed |
outbound.cancelled | Outbound cancelled |
outbound.evidence.uploaded | Warehouse uploaded evidence |
Event types use category.event: the main category is outbound and the sub-type is created, approved, and so on. Subscription events supports the outbound.* wildcard to receive every event in the category.
Delivery
- Method:
POST - Content-Type:
application/json - Timeout: 5 seconds for connect and read
- Success: any
2xx - Retry: both subscription-based and dedicated URLs retry after a failure, up to 5 times, with delays
1m,5m,30m,2h,6h; then stop - Ordering: not guaranteed; use
occurred_atanddata.status - Idempotency: consumers must dedupe by
id - Dedicated URL: pass
webhook_urlwhen submitting an outbound request; the system generateswebhook_secretfor that outbound (readable via/outbound/detail), and delivers withX-E2C-Webhook-Id: 0. Dedicated URLs are enqueued in the same outbox as subscriptions and retry with the same backoff policy
Headers
| Header | Description |
|---|---|
X-E2C-Event | Event type, e.g. outbound.stock_ready |
X-E2C-Delivery | Event ID, identical to the payload id (retries reuse the same value) |
X-E2C-Timestamp | Unix seconds |
X-E2C-Signature | sha256=<hex hmac> |
X-E2C-Webhook-Id | Subscription ID; 0 for dedicated URL delivery |
Signature
signature = HMAC_SHA256(secret, timestamp + "." + raw_request_body)
header = "sha256=" + hex(signature)Verify:
- Read the raw body (before JSON parsing).
- Reject if
abs(now - X-E2C-Timestamp) > 300seconds. - Compute the HMAC with the shared secret.
- Compare using a constant-time function.
- Return
2xxquickly; process asynchronously.
Payload
{
"id": "evt_5f3c9a7d1e2b4c6d8e0f1a2b",
"type": "outbound.stock_ready",
"version": "1.0",
"occurred_at": "2026-11-11T10:30:00+00:00",
"data": {
"outbound_id": 5001,
"outbound_no": "OB20261111100000123",
"source_type": "partner_outbound",
"source_id": 1001,
"member_id": 42,
"warehouse_id": 1,
"status": "stock_ready",
"previous_status": "warehouse_confirmed",
"stock_ready_at": "2026-11-11T10:30:00",
"dispatch_task_id": null,
"tracking_number": null
}
}Field Reference
| Field | Type | Description |
|---|---|---|
id | string | Event ID, evt_ + 24 hex characters, used for idempotency |
type | string | Event type |
version | string | Payload version, currently 1.0 |
occurred_at | ISO8601 | Event time (with server timezone offset) |
data.outbound_id | integer | Generic outbound order ID |
data.outbound_no | string | Outbound number |
data.source_type | string | Source type; partner_outbound for partner outbound |
data.source_id | integer | Source record ID (outbound request ID for partners) |
data.member_id | integer | Owner member ID |
data.warehouse_id | integer | Warehouse ID |
data.status | string | Current SOP status |
data.previous_status | string/null | Previous SOP status |
data.stock_ready_at | datetime/null | Stock-ready time |
data.dispatch_task_id | integer/null | ERP dispatch task ID |
data.tracking_number | string/null | Tracking number; usually null for partner outbound, use the dispatch task or carrier callback instead |
Example Verification (Node.js)
import crypto from 'crypto'
function verify(rawBody, headers, secret) {
const ts = headers['x-e2c-timestamp']
if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(`${ts}.${rawBody}`)
.digest('hex')
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(headers['x-e2c-signature']))
}List Subscriptions
/channel/api/v1/webhook/subscriptionsAuth: request-token (channel_partner)
List all outbound webhook subscriptions of the current member, ordered by ID descending. events is decoded into an array; secret is never returned.
Required capability: outbound_webhook_manage
Request Body
No request parameters.
Response
{
"code": 200,
"msg": "success",
"data": [
{
"id": 12,
"member_id": 42,
"url": "https://partner.example.com/hooks/e2c",
"events": ["outbound.stock_ready", "outbound.shipped"],
"active": 1,
"created_at": "2026-11-10 09:00:00",
"updated_at": "2026-11-10 09:00:00"
}
]
}Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_webhook_manage required) |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/webhook/subscriptions' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'Save Subscription
/channel/api/v1/webhook/subscriptions/saveAuth: request-token (channel_partner)
Create or update a subscription. Pass id to update one of the member's subscriptions; omit id to create. When secret is omitted a random 24-byte hex string (48 characters) is generated. Note: every update writes secret — a provided value is used, otherwise a new secret is generated and the old one becomes invalid. Omitting active sets it to 0 (disabled).
Required capability: outbound_webhook_manage
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | no | Subscription ID; present means update |
url | string | yes | Valid URL receiving the webhook (HTTP/HTTPS) |
events | string[] | yes | Event array, at least one item; only values from the event table are kept |
secret | string | no | Signing secret; generated when empty |
active | boolean/integer | no | Whether enabled; default false (0) |
Response
{
"code": 200,
"msg": "success",
"data": {
"id": 12,
"secret": "5d41402abc4b2a76b9719d911017c5923f9c1d2e4b6a8f0c"
}
}secret is returned by this endpoint only; store it securely immediately.
Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_webhook_manage required) |
| 400 | Missing or invalid url, or events empty / entirely invalid |
| 404 | Subscription not found on update, or not owned by this member |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/webhook/subscriptions/save' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://partner.example.com/hooks/e2c",
"events": [
"outbound.stock_ready",
"outbound.shipped"
],
"active": true
}'Delete Subscription
/channel/api/v1/webhook/subscriptions/deleteAuth: request-token (channel_partner)
Delete one of the current member's subscriptions. Returns 404 when id does not exist or is not owned by this member.
Required capability: outbound_webhook_manage
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
id | integer | yes | Subscription ID (alias subscription_id accepted) |
Response
{
"code": 200,
"msg": "success",
"data": null
}Error Codes
| code | Meaning |
|---|---|
| 909 | Unauthenticated, invalid token, or not a channel partner |
| 606 | Insufficient capability (outbound_webhook_manage required) |
| 400 | Missing id |
| 404 | Subscription not found or not owned by this member |
cURL
curl -X POST 'https://apigate.e2c-energy.com/channel/api/v1/webhook/subscriptions/delete' \
-H 'request-token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"id": 12
}'Delivery Logs And Retries
- Delivery mode: every delivery (subscription + dedicated URL) is first written to the
t_plan_task_recordoutbox (type=WebhookDelivery) and executed asynchronously byplan-task-worker.php; business requests no longer wait for the HTTP delivery - Worker:
php script/tools/plan-task-worker.php --limit=50(run every minute); the oldoutbound-webhook-retry.phpremains as a compatibility entry point - Delivery state:
status,attempts,next_retry_at,result,last_erroront_plan_task_record;wms_outbound_webhook_deliveryis kept for historical data only