HTTP POST payloads that are delivered to your webhook's configured URL endpoint contain several important properties.
Sparkbox webhooks contain special HTTP headers. Below are the headers used:
Content-Type
application/json.
Content-Type: application/json
X-Event-Type
event.type).
X-Event-Type: model.submitted
X-Hook-UUID
X-Hook-UUID: 123e4567-e89b-12d3-a456-426614174001
X-Attempt-Number
X-Attempt-Number: 3
X-Sparkbox-Signature
X-Sparkbox-Signature: sha256=5e011ee705920362b3c19e01fd84510fff715a612419d1b4912fa8bf894b6d85Sparkbox webhooks deliver payloads in JSON format. Below is an overview of the payload structure.
id: A unique event ID.
type: The workflow event that triggered the payload.
timestamp: The timestamp indicating when the event occurred.
api_version: The API version.
Example:
{
"event": {
"id": "abcdefgh-ijkl-mnop-qrst-uvwxyz012345",
"event_type": "model.submitted",
"timestamp": "2023-11-16T12:30:45Z",
"api_version": "v1"
},
"data": [
// Event-specific data
]
}
model.submitted
uuid: a unique ID for the recommendation in the department
region-wave.
taken: taken status of the recommendation in the department
region-wave.
status: workflow status of the recommendation in the
department region-wave.
sku_id: the sku ID corresponding to the product for which
the recommendation was generated.
division_desc: the description of the division
corresponding to the product for which the recommendation was generated.
department_desc : the description of the department
corresponding to the product for which the recommendation was generated.
sku_desc : the description of the product for which the
recommendation was generated.
current_price : current price of the product for which the
recommendation was generated.
opt_price : the recommended price.units_to_md : number of units that will be marked down.
start_date : start date of the recommended price.end_date : end date of the recommended price.wave_type : type of wavemodel.approved
uuid: a unique ID for the recommendation in the department
region-wave.
taken: taken status of the recommendation in the department
region-wave.
status: workflow status of the recommendation in the
department region-wave.
sku_id: the sku ID corresponding to the product for which
the recommendation was generated.
division_desc: the description of the division
corresponding to the product for which the recommendation was generated.
department_desc : the description of the department
corresponding to the product for which the recommendation was generated.
sku_desc : the description of the product for which the
recommendation was generated.
current_price : current price of the product for which the
recommendation was generated.
opt_price : the recommended price.units_to_md : number of units that will be marked down.
start_date : start date of the recommended price.end_date : end date of the recommended price.wave_type : type of wavemodel.retracted
uuid: a unique ID for the recommendation in the department
region-wave.
taken: taken status of the recommendation in the department
region-wave.
status: workflow status of the recommendation in the
department region-wave.
sku_id: the sku ID corresponding to the product for which
the recommendation was generated.
division_desc: the description of the division
corresponding to the product for which the recommendation was generated.
department_desc : the description of the department
corresponding to the product for which the recommendation was generated.
sku_desc : the description of the product for which the
recommendation was generated.
current_price : current price of the product for which the
recommendation was generated.
opt_price : the recommended price.units_to_md : number of units that will be marked down.
start_date : start date of the recommended price.end_date : end date of the recommended price.wave_type : type of waveUsing HTTPS is recommended for your webhook URL because it is more secure. Sparkbox webhooks support either HTTP or HTTPS. If you are using HTTPS, your SSL/TLS certificate must be validated. (Self-signed certificates are not supported.)
Ensure your server only processes webhook payloads that were sent by Sparkbox by validating the signature before processing the payload further.
If one is provided, Sparkbox will use a secret token to create an HMAC signature sent as the value of the X-Sparkbox-Signature header.
To validate the payload, generate the signature yourself by creating a hash of the entire received payload (using the shared secret as a key) and compare that signature with the signature you receive from Sparkbox.