Webhooks v3
Get notified when specific events occur on a BigCommerce store. For more information, see the Webhooks Overview, Webhooks Events, or Webhooks Tutorial.
In general, webhook usage follows the workflow
- Create a webhook for a specific scope using Create a Webhook
- Receive event callback payload at the destination URL
- Respond to callback with success status
2xx
or any failure status- On failure, await second callback attempt
- On success, move to event handling
- Handle event based on payload
Callback payloads have a uniform structure, including the minimum information to uniquely identify what event occurred, on what store, with respect to what data, and at what time. The data
object serves as the only variable data structure in the payload.
For inventory and location events, data
will include location_id
, and variant_id
or product_id
as necessary. For all other events data
will include type
, id
, and any scope-specific information (such as couponId
for the store/cart/couponApplied
). Scope-specific fields are outlined in the Webhooks Events.
An example of payload structure is include below. Datatypes are outlined in the following table.
Field | Type | Example |
---|---|---|
producer | string | stores/abc123 |
hash | string | dd70c0976e06b67aaf671e73f49dcb79230ebf9d |
created_at | integer | 1561479335 |
store_id | string | 1025646 |
scope | string | store/order/created |
data | object | variable |
data.type | string | product |
data.id | integer | 223 |
{
"producer": "stores/<STORE_HASH>"
"hash": <EVENT_HASH>,
"created_at": <EVENT_TIMESTAMP>,
"store_id": <STORE_ID>,
"scope": <WEBHOOK_SCOPE>,
"data": {
<EVENT_DATA>
},
}