Web-hook task retrieval
As an option, you can chose instead of polling, to set up an endpoint that will automatically receive the document's extracted data whenever it is done parsing.
Setting up
The setting up of the webhook is made through the platform. You can only set up the web hook if you are a company administrator. This menu can be found in settings -> api.

Insert the url from your webhook, and test out your path. Once you have a working webhook, the setup is complete on koncile's side. You can move to the Webhook call segment to set up your receival endpoint.
Webhook call
The message sent by the webhook follows the same output as the task retrieval and document fetching
{
"status": DONE | DUPLICATE | IN PROGRESS | FAILED,
"document_id": ID,
"document_name": str,
"status_message": str,
"General_fields":
{
"field_name" : {"value": str, "confidence_score": float},
"field_name" : {"value": str, "confidence_score": float}
}
,
"Line_fields":
{
"field_name" : [{"value": str, "confidence_score": float}, {"value": str, "confidence_score": float}, {"value": str, "confidence_score": float}],
"field_name" : [{"value": str, "confidence_score": float}, {"value": str, "confidence_score": float}, {"value": str, "confidence_score": float}]
}
}Example endpoint
npm init -y
npm install express body-parserconst express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.use(bodyParser.json());
app.post("/web-hook/", (req, res) => {
console.log("Webhook received:");
console.log(JSON.stringify(req.body, null, 2));
res.json({ message: "Webhook received successfully" });
});
const PORT = 8000;
app.listen(PORT, () => {
console.log(`Listening on http://localhost:${PORT}/web-hook/`);
});node webhookReceiver.jsThen go to Koncile, paste http://${your-url}:8000/web-hook/ as the webhook URL, and trigger a test document.
pip install fastapi uvicornfrom fastapi import FastAPI, Request
import uvicorn
app = FastAPI()
@app.post("/web-hook/")
async def receive_webhook(request: Request):
payload = await request.json()
print("\n Webhook received:")
print(payload)
return {"message": "Webhook received successfully"}
if name == "main":
print("Listening on http://localhost:8000/web-hook/")
uvicorn.run("webhook_receiver:app", host="0.0.0.0", port=8000, reload=True)
python webhook_receiver.pyThen go to Koncile, paste http://${your-url}:8000/web-hook/ as the webhook URL, and trigger a test document.
Last updated
Was this helpful?

