Create Webhooks
You can receive our processing results as soon as they are completed.
To do this, it is necessary to create a Webhook that will receive our request.
Only one Webhook type can be created at a time, so if you want to change its configuration, you must delete the existing Webhook first.
Below you will find how to register a Webhook via API.
It is important to note that the webhook URL must follow the pattern using ":id".
This is the parameter where we will send the processed document ID. See the examples below.
Document Service - Webhook Creation
POST Environment URL/document_webhooks
Header
| Identifier | Value |
|---|---|
| Content-type | application/json |
| IDEXA-API-KEY | [api_key] |
Payload
| Parameter | Description | Required | Type | Examples |
|---|---|---|---|---|
| name | Descriptive name of the Webhook | Yes | String | Webhook 1 |
| type | Internal Webhook type code (0-Document finished) | Yes | Integer | 0 |
| method | HTTP method to be sent (POST, PUT, GET, DELETE) | Yes | String | "POST" |
| headers | Headers to be sent | No | JSON | {"Content-Type": "application/json"} |
| headerAuth | Authorization header type (Bearer) | No | String | "Bearer" |
| url | URL to be called | Yes | String | "http://localhost:5000/ocr_feedback/:id" |
| authorization | Authorization header (if you want a fixed authorization) | No | String | "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJI..." |
| authorizationUrl | Authentication URL for webhook execution time | No | String | "http://localhost:5000/login" |
| authorizationMethod | Authentication method for webhook execution time | No | String | "POST" |
| authorizationHeaders | Headers for authentication at webhook execution time | No | JSON | {"Content-Type": "application/x-www-form-urlencoded"} |
| authorizationBody | Body for authentication at webhook execution time | No | JSON | {"username": "root", "password": "root"} |
| authorizationResponseTokenAttr | Name of the attribute in the authenticat |
{
"id": "a7046a49-1fe0-483d-b220-cd93fe50a3a9",
"clientId": "113d37ed-6b47-46b6-bc50-bf5d64ad3a94",
"name": "Webhook 1",
"type": 0,
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"headerAuth": "Bearer",
"url": "http://localhost:5000/ocr_feedback/:id",
"authorization": null,
"authorizationUrl": "http://localhost:5000/login",
"authorizationMethod": "POST",
"authorizationHeaders": {
"Content-Type": "application/x-www-form-urlencoded"
},
"authorizationResponseTokenAttr": "access_token",
"createdAt": "2024-04-11T14:12:33.741194-03:00",
"updatedAt": "2024-04-11T14:12:33.741194-03:00"
}