πŸ†•Webhook

Webhooks allow you to receive real-time notifications of events happening within your Extracta LABS extractions. This section will guide you through setting up a Node.js server with Express to securely listen for and handle webhook events.


Webhook Payload Structure

Each webhook sent by Extracta LABS will include two primary fields in the request body:

  • event – A string identifying the type of event (e.g., extraction.processed, extraction.failed).

  • result – A list containing files data

Example payload:

{
  "event": "extraction.processed",
  "result": [
    {
      "extractionId": "extractionId",
      "batchId": "batchId",
      "fileId": "fileId",
      "fileName": "fileName",
      "status": "processed",
      "result": {},
      "url": "fileUrl"
    }
  ]
}

See all event types

πŸ†•Webhook Event Typeschevron-right

Prerequisites

  • Node.js installed on your server

  • An Express.js application

  • A secret key obtained from the Extracta LABS dashboard


Step 1: Set Up Your Server

First, ensure you have Express and the necessary packages installed in your project. If not, you can install them using npm:


Step 2: Implement Webhook Endpoint

Create a basic HTTP server with Express to listen for webhook POST requests. Use the following code snippet as a starting point:


Step 3: Test Your Webhook Listener

Once your webhook listener is set up, test it by triggering events from Extracta LABS. Confirm that:

  • The signature is validated correctly.

  • The event is identified.

  • The result is handled based on the event type.


By following these steps, you can securely set up your application to receive and process webhook events from Extracta LABS, enabling real-time updates and actions based on the events transmitted to your endpoint.

Last updated