LogoLogo
WebsiteLoginSign up
  • Welcome to Koncile
  • Getting Started
    • Key Koncile features
    • Folders vs. Extraction Templates
    • General fields vs. Repeated fields
  • DATA EXTRACTION APP
    • Set up an Extraction Template
    • Set field format
    • How to write field descriptions
    • Import documents
      • Importing amendments
    • Export data
    • Auto-classify documents
  • Generated fields with AI
  • API Setup
    • API Key generation
    • Swagger
    • API pricing and limits
    • SDK Libraries
      • Python guide
    • File Uploading
    • Task Retrieval
      • Web-hook task retrieval
      • Polling task retrieval
    • Folders
    • Templates
    • Fields
    • Instructions
    • API status codes
    • Bubble Plugin
  • Miscellaneous
    • Q&A
Powered by GitBook
LogoLogo

Useful links

  • Website
  • Login
  • Extraction template library

@Copyright Koncile 2024

On this page
  • Setting up
  • Webhook call
  • Example endpoint

Was this helpful?

Export as PDF
  1. API Setup
  2. Task Retrieval

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.

PreviousTask RetrievalNextPolling task retrieval

Last updated 2 days ago

Was this helpful?

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-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.

pip install fastapi uvicorn
main.py
from 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.py

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

Settings page for the web hook