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