Search
K
Links

Webhook Payloads

Prepare to receive the responses from Unitary services

Using Webhooks to access the job results

This article focuses on the response payload of the Webhooks. Please checkout the Integrating Webhooks guide if you want to learn more about how to use Webhooks.
After the processing of a video, image, or text job is finished, a POST request will be made to the callback_url provided in the request body.
Please check the API Integration for a list of all the available endpoints.

Payload of a successful job

{
"data": {
"job_id": "b98d467c-01df-43e9-8a03-d3c92ab71a17",
"callback_url": "<callback_url>",
"is_error": false,
"result": {
"garm_categories": [
{
"name": "ARMS_AMMO",
"description": "Arms & Ammunition",
"risk_level": "HIGH"
},
{
"name": "DEATH_INJURY_MILITARY",
"description": "Death, Injury or Military Conflict",
"risk_level": "MEDIUM"
}
],
"metadata": {
"width": 720,
"height": 458,
"fps": 30,
"duration": 11.5859375,
"seconds_processed": 11.4
},
"url": "<resource_url>"
}
},
}

Payload of a failed job

{
"data": {
"job_id": "92c4bcf1-a090-4519-9ed4-6eb7e1f2b28b",
"callback_url": "<callback_url>",
"is_error": true,
"result": {
"error": "Failed to decode video."
}
}
}

Response Validation

The response payload is validated using the X-Hub-Signature-256 header that has base64 format.
The payload is hashed using the HMAC-SHA256 algorithm with a secret key (or cryptographic key) that is setup beforehand. If no key is set, the header in question will not be present.
For the error json presented above and the secret set as test_key, the header will have the value hYOb+67Z15TMwHO678Yd2fQykmBDwPdBa+O7FnXOqOY=
This online generator uses the same algorithm. Please be aware of the whitespaces inside the payload, they count.

Custom payload data

The callback_url is used as is, so you can append custom data to the request by controlling the query parameters.
For example you can send back the original file name or the time of the original request.
// with filename
"callback_url": "your.callback.server/?filename=original_file_name.mp4"
// with timestamp
"callback_url": "your.callback.server/?current_timestamp=1687864622"
// with filename and timestamp
"callback_url": "your.callback.server/?current_timestamp=1687864622&filename=original_file_name.mp4"
The additional data will also be part of the payload body.
Last modified 1mo ago
Copyright © Unitary Ltd