Skip to main content
Version: 2.0.0

Webhooks

LLMWhisperer from V2 onwards supports webhooks. You can now register a webhook and use it to receive the processed document.

Requirements​

  • A publicly accessible URL to receive the webhook. (Can be internal in on-prem installations)
  • The URL must be able to receive POST requests.
  • The URL must be able to handle the payload sent by the webhook.
  • Only Bearer token authentication is supported for webhooks. If no authentication is enabled at the webhook endpoint leave the auth_token as empty string
  • The webhook must return a 200 status code to acknowledge receipt of the payload.
  • A maximum of 3 retries will be made in case of a failure. (Can be changed in on-prem installations)

Payload​

The payload sent to the webhook will be a JSON object with the following structure:

{
"payload_status": {
"status": "success", # The status of the payload.
"message": "" # Message in case of error
"whisper_hash": "<WHISPER_HASH>" # Whisper hash of intiated request.
},
"line_metadata": [], # Refer to retrieve API for details
"confidence_metadata": [], # Refer to retrieve API for details
"result_text": "extracted_text", # The extracted text
"metadata": {} # Refer to retrieve API for details
}

For requests made with the Document Insights API, the payload carries the signatures and table of contents instead of the extracted text. Refer to the Document Insights Retrieve API for that payload.

Setting up a webhook​

To set up a webhook, you need to provide the following details:

  • url (str, required): The URL of the webhook to call after the document is processed.
  • auth_token (str, required): The Bearer token to use for authentication. Note: Pass the token alone without the 'Bearer' keyword. If no authentication is enabled at the webhook endpoint leave the auth_token as empty string
  • webhook_name (str, required): The name of the webhook to register.

You can register a webhook with the Webhook Management API. Once the webhook is registered, it can be used in the whisper API to deliver the payload after processing the document.