Webhooks
OCUS can notify your remote system about your processes through real-time notifications
Webhook settings
Directly configure your webhook URL from your user interface to receive immediate notifications as soon as your files are processed
Payload format
Every time a full batch has been processed, you will receive a notification on the configured URL.
Requests are sent using the POST method with the application/json content type. Each webhook message contains the main details about the batch. Here's an example of payload.
{
"event":"batch.completed",
"id":"996a36ec-f832-45c2-b974-0a4e37fee685",
"status":"COMPLETED",
"project":"PRJ-EXA",
"workflow":"food",
"percentage": 100,
"created_at":"2023-06-15T07:37:50.000000Z",
"created_by":"[email protected]"
}
After receiving a webhook notification you can retrieve the full result using the Retrieve batch process endpoint.
Note: The percentageattributes indicates the number of images approved matching the quality requirements of your workflow ("approved" or "enhanced" files).
Webhooks authentication
Our server adds a Signature header to every request. This signature is generated by encoding the response payload with the secret passphrase associated with your webhook configuration. This secret passphrase is generated during the webhook configuration
<?php
$secret = "this-is-my-secret-key-used-to-sign-requests";
$payloadJson = file_get_contents('php://input');
$signature = hash_hmac('sha256', $payloadJson, $secret);
$headers = apache_request_headers();
if ($headers['Signature'] != $signature) {
header("HTTP/1.1 401 Unauthorized");
die("401 Unauthorized");
}
$object = json_decode($payloadJson);Updated 7 months ago