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.

Settings page for the web hook

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-parser
webhookReceiver.js
const 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.js

Then go to Koncile, paste http://${your-url}:8000/web-hook/ as the webhook URL, and trigger a test document.

Last updated

Was this helpful?