Webhook Management API
| Endpoint | whisper-manage-callback | 
| URL | https://llmwhisperer-api.us-central.unstract.com/api/v2/whisper-manage-callback | 
| Method | GET POST PUT DELETE | 
| Headers | unstract-key: <YOUR API KEY>Content-Type: application/json | 
Parameters
Only GET and DELETE methods require parameters.
| Parameter | Type | Default | Required | Description | 
|---|---|---|---|---|
| webhook_name | string | Yes | The name of the webhook. | 
Request Body for POST and PUT methods
{
    "url": "<URL to be called after conversion is done>",
    "auth_token": "<Token (bearer)>",
    "webhook_name": "<Name of the webhook>"
}
If no authentication is enabled at the webhook endpoint leave the auth_token as empty string
When a webhook is registered with this API, it will send a dummy payload to the URL to check if the URL is functioning. If the URL is not functioning, the webhook will not be registered. The URL should return a 200 status code. The payload sent will be:
{
  "payload_status": {
    "status": "test",
    "message": "Testing webhook"
  },
  "line_metadata": [],
  "confidence_metadata": [],
  "result_text": "WEBHOOK_TEST",
  "metadata": {}
}
Example Curl Requests
Register a webhook
curl -X POST --location 'https://llmwhisperer-api.us-central.unstract.com/api/v2/whisper-manage-callback' \
-H 'unstract-key: <Your API Key>' \
-H 'Content-Type: application/json' \
-d '{"url":"https://<url-of-webhook>","auth_token":"<Token (bearer)>","webhook_name":"<Name of the webhook>"}'
Get webhook details
curl -X GET --location 'https://llmwhisperer-api.us-central.unstract.com/api/v2/whisper-manage-callback?webhook_name=<Your webhook name>' \
-H 'unstract-key: <Your API Key>'
Update a webhook
curl -X PUT --location 'https://llmwhisperer-api.us-central.unstract.com/api/v2/whisper-manage-callback' \
-H 'unstract-key: <Your API Key>' \
-H 'Content-Type: application/json' \
-d '{"url":"https://<new-url-of-webhook>","auth_token":"<New Token (bearer)>","webhook_name":"<Name of the existing webhook>"}'
Delete a webhook
curl -X DELETE --location 'https://llmwhisperer-api.us-central.unstract.com/api/v2/whisper-manage-callback?webhook_name=<Your webhook name>' \
-H 'unstract-key: <Your API Key>'
Response for POST method
| HTTP Status | Content-Type | Headers | Description | 
|---|---|---|---|
| 201 | application/json | The API will return a JSON with the message. Refer below for JSON format | 
Example 201 Response
{
    "message": "Webhook created successfully"
}
Example 400 Response
{
    "message": "Error calling webhook: Webhook check failed: {\"error\":\"Unauthorized\"}\n"
}
Response for GET method
| HTTP Status | Content-Type | Headers | Description | 
|---|---|---|---|
| 200 | application/json | The API will return a JSON with the webhook details. Refer below for JSON format | 
Example 200 Response
{    
    "url": "<URL to be called after conversion is done>",
    "auth_token": "<Token (bearer)>",
    "webhook_name": "<Name of the webhook>"
}
Response for PUT method
| HTTP Status | Content-Type | Headers | Description | 
|---|---|---|---|
| 200 | application/json | The API will return a JSON with the message. Refer below for JSON format | 
Example 200 Response
{
    "message": "Webhook updated successfully"
}
Response for DELETE method
| HTTP Status | Content-Type | Headers | Description | 
|---|---|---|---|
| 200 | application/json | The API will return a JSON with the message. Refer below for JSON format | 
Example 200 Response
{
    "message": "Webhook deleted successfully"
}