Webhooks & delivery
Receive Webhooks
In HIOBuy Developer Center → Webhooks , select the same App and register your production HTTPS endpoint. Subscribe to all four events below before enabling post-send recall, and adapt every receiver first. Existing subscriptions are not automatically expanded. Supplier inquiry does not require warehouse activation or direct registration in HIOAsk. inquiry.webhook_configured=true only checks for an active subscription to one of the three foundational events (created, updated or closed); it is not a recall/media capability flag and does not prove complete subscriptions or successful delivery.
| Event | |
|---|---|
ask.message.created | A released customer-facing staff reply; data.message is present. |
ask.message.recalled | A staff reply was recalled; persist the terminal message placeholder, even before creation. |
ask.conversation.updated | A public conversation status/assignment snapshot changed. |
ask.conversation.closed | Conversation ended; read rating availability. |
Save the once-displayed HIOBuy developer Webhook signing secret on your server, separately from the API Key. The public envelope has id, type, created_at, livemode, app_id and data. Outer app_id is your HIOBuy App; data.conversation.external_app_id is managed by HIOBuy. Portal test events have livemode=false and are not proof of a real supplier reply.
{
"id": "evt_example_001",
"type": "ask.message.created",
"created_at": "2026-11-13T13:01:01.000Z",
"livemode": true,
"app_id": "app_example",
"data": {
"conversation": {
"id": "11111111-1111-4111-8111-111111111111",
"external_app_id": "hiobuy:app_example",
"external_conversation_id": "customer-42-1688-673124809943-1",
"external_user_id": "customer-42",
"language": "en",
"context": {
"type": "product",
"product_url": "https://detail.1688.com/offer/673124809943.html",
"product_id": "673124809943",
"product_title": "Knitted shoulder bag"
},
"target_language": "en",
"status": "waiting_customer",
"created_at": "2026-11-13T13:00:00.000Z",
"updated_at": "2026-11-13T13:00:00.000Z"
},
"message": {
"id": "22222222-2222-4222-8222-222222222222",
"conversation_id": "11111111-1111-4111-8111-111111111111",
"client_message_id": "22222222-2222-4222-8222-222222222222",
"sender_type": "staff",
"type": "text",
"content": "We can help you confirm neutral packaging with the supplier.",
"language": "en",
"status": "accepted",
"translation_status": "translated",
"created_at": "2026-11-13T13:01:00.000Z",
"attachments": []
}
}
}Verify delivery
Verify HioBuy-Signature: t=<unix_seconds>,v1=<hex_hmac_sha256> over the exact raw request bytes: HMAC-SHA256(secret, timestamp + ”.” + rawBody). Reject missing/malformed signatures, timestamps outside ±300 seconds and mismatched App IDs. Use constant-time comparison before parsing JSON; do not parse and reserialize the body first. The helper below expects a bounded Buffer from your HTTP server. Return an error on failed verification; never log the secret.
import { createHmac, timingSafeEqual } from "node:crypto";
export function verifyHioBuyWebhook(rawBody, signature, secret, expectedAppId) {
if (!Buffer.isBuffer(rawBody) || rawBody.length > 256 * 1024) throw new Error("Invalid body");
const match = /^t=([0-9]{1,12}),v1=([a-f0-9]{64})$/.exec(signature ?? "");
if (!match || Math.abs(Date.now() / 1000 - Number(match[1])) > 300) {
throw new Error("Invalid signature timestamp");
}
const expected = createHmac("sha256", secret).update(match[1] + ".").update(rawBody).digest();
const actual = Buffer.from(match[2], "hex");
if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) {
throw new Error("Invalid signature");
}
const event = JSON.parse(rawBody.toString("utf8"));
if (event.app_id !== expectedAppId || typeof event.id !== "string") throw new Error("Invalid event App");
if (!["ask.message.created", "ask.message.recalled", "ask.conversation.updated", "ask.conversation.closed"].includes(event.type)) {
throw new Error("Unsupported event");
}
return event;
}Delivery is at least once and can be delayed or out of order. Durably deduplicate by the outer event id, store acceptance and message updates transactionally, then acknowledge 2xx. Reject reuse of an event ID with different content. Do not reopen a closed conversation because an older status event arrives later. Return non-2xx when durable acceptance fails so HIOBuy can retry; inspect attempts or request a retry in the Developer Center.
Keep message API reconciliation on page load, reconnect and periodically with backoff. Refresh both the newest page and previously loaded/visible history pages: recall preserves created_at and does not move an older message to the first page. A cursor only loads older records; there is no since/updated_since change feed. Merge by App + conversation + message ID and preserve any stored recalled_at tombstone over an older normal response. Fetch current conversation/rating state; never reopen a closed conversation from an old event. Keep drafts and stable send IDs after uncertain sends.
HIOBuy derives the App from your Key. Do not send X-External-App-Id, choose an App on behalf of the client, or connect directly to HIOAsk. Never expose API Keys or Webhook secrets in browser storage, frontend code, URLs or logs. Your backend must additionally enforce which signed-in customer owns each conversation: App isolation alone is not end-user authorization.
Errors & recovery
| HTTP | Code |
|---|---|
| 400 | MISSING_IDEMPOTENCY_KEY / INVALID_CURSOR / VALIDATION_ERROR |
| 401 | INVALID_API_KEY |
| 403 | SUPPLIER_INQUIRY_NOT_ENABLED / INSUFFICIENT_SCOPE / INQUIRY_SANDBOX_UNAVAILABLE |
| 404 | CONVERSATION_NOT_FOUND |
| 409 | IDEMPOTENCY_KEY_REUSED / CONVERSATION_CONFLICT / CLIENT_MESSAGE_ID_CONFLICT |
| 409 | CONVERSATION_CLOSED / PRODUCT_CARD_NOT_FIRST / RATING_ALREADY_SUBMITTED |
| 410 | RATING_WINDOW_CLOSED / HIOASK_V1_RETIRED |
| 429 | RATE_LIMIT_EXCEEDED / DAILY_QUOTA_EXCEEDED |
| 502 | HIOASK_INTEGRATION_REJECTED |
| 503 | HIOASK_BINDING_NOT_READY / HIOASK_UNAVAILABLE |
For 401, check your own Key without exposing it. For 403, check App enablement, read/write scopes and production environment. For 409, resolve the existing resource or retry the unchanged intent. For 429, honor Retry-After when provided. For transient 502/503, use bounded backoff; HIOASK_BINDING_NOT_READY requires HIOBuy configuration. The current Gateway maps upstream permission denials, including disabled media, to 502 HIOASK_INTEGRATION_REJECTED; this does not by itself mean the developer Key is invalid. Never repeatedly create a new conversation after an uncertain response.
/v1/supplier-inquiries and its detail/message routes return HTTP 410 HIOASK_V1_RETIRED. The former questions, typed answers and supplier_inquiry.* events are retired. Use /v1/ask/* and the ask.* events documented here, including ask.message.recalled for recall-ready integrations. Historical V1 data is retained without automatic conversion.
Recall and out-of-order delivery
ask.message.recalled identifies the same published staff message with recalled_at, empty content and no media. Persist a terminal tombstone keyed by App + conversation + message, even if recall arrives before creation. In the same durable transaction as event acceptance, remove its displayed text, attachments and public caches. Duplicate recalls are harmless; later created events, delayed polling responses or reloads must never restore the recalled content. Keep the original created_at for ordering. Previously read or downloaded content cannot be guaranteed unread or erased.
After adapting all receivers and history reconciliation, ask HIOBuy to confirm recall enablement for your integration. Other integrations retain the legacy behavior. There is no public developer recall endpoint; this operation applies to eligible staff replies, not customer messages or internal notes.
{
"id": "evt_example_recall_001",
"type": "ask.message.recalled",
"created_at": "2026-11-13T13:01:15.000Z",
"livemode": true,
"app_id": "app_example",
"data": {
"conversation": {
"id": "11111111-1111-4111-8111-111111111111",
"external_app_id": "hiobuy:app_example",
"external_conversation_id": "customer-42-1688-673124809943-1",
"external_user_id": "customer-42",
"language": "en",
"context": {
"type": "product",
"product_url": "https://detail.1688.com/offer/673124809943.html",
"product_id": "673124809943",
"product_title": "Knitted shoulder bag"
},
"target_language": "en",
"status": "waiting_customer",
"created_at": "2026-11-13T13:00:00.000Z",
"updated_at": "2026-11-13T13:00:00.000Z"
},
"message": {
"id": "22222222-2222-4222-8222-222222222222",
"conversation_id": "11111111-1111-4111-8111-111111111111",
"client_message_id": "22222222-2222-4222-8222-222222222222",
"sender_type": "staff",
"type": "text",
"content": "",
"language": "en",
"status": "accepted",
"translation_status": "translated",
"created_at": "2026-11-13T13:01:00.000Z",
"attachments": [],
"recalled_at": "2026-11-13T13:01:15.000Z"
}
}
}Message references for enabled integrations
Reference-enabled integrations may receive reply_to_message_id in the existing ask.message.created message. Persist the association, not a copied excerpt. Resolve it through the same App + conversation message map. If the target has recalled_at, every referencing display must use a recall placeholder, including when recall arrives before creation or a referencing reply. A recalled reply also hides its own reference. Older API responses and immutable creation retries must not restore quoted text or media. Keep event ID/payload deduplication and signatures unchanged. Do not downgrade receivers while reference-bearing events or history remain in use.
Get Support
Need integration help? Contact Developer Support at support@hiobuy.com · Response within 1–2 business days