Webhooks
Receive real-time notifications when events occur in your LH42 account.
Setting Up Webhooks
- Go to Settings > Webhooks
- Click "Add Webhook"
- Enter your endpoint URL
- Select events to subscribe to
- Save and copy the signing secret
Event Types
| Event | Description |
|---|---|
document.uploaded | Document upload started |
document.processed | Document fully indexed |
document.failed | Processing failed |
document.deleted | Document removed |
search.completed | Search query executed |
Payload Format
json
{
"id": "evt_123abc",
"type": "document.processed",
"created_at": "2026-01-20T10:30:00Z",
"data": {
"document_id": "doc_xyz",
"title": "Q4 Report",
"chunks": 24,
"processing_time_ms": 1250
}
}Verifying Signatures
Always verify webhook signatures:
python
import hmac
import hashlib
def verify_signature(payload, signature, secret):
expected = hmac.new(
secret.encode(),
payload.encode(),
hashlib.sha256
).hexdigest()
return hmac.compare_digest(f"sha256={expected}", signature)Retry Policy
Failed deliveries are retried with exponential backoff:
- Attempt 1: Immediate
- Attempt 2: 1 minute
- Attempt 3: 5 minutes
- Attempt 4: 30 minutes
- Attempt 5: 2 hours
Best Practices
- Respond quickly - Return 200 within 5 seconds
- Process async - Queue webhooks for background processing
- Handle duplicates - Use event IDs for idempotency
- Monitor failures - Set up alerts for failed deliveries