NewMCP ServerView docs
API

Webhooks

Set up webhooks to receive real-time notifications when documents are processed or search events occur.

6 min readUpdated 2026-01-17

Webhooks

Receive real-time notifications when events occur in your LH42 account.

Setting Up Webhooks

  1. Go to Settings > Webhooks
  2. Click "Add Webhook"
  3. Enter your endpoint URL
  4. Select events to subscribe to
  5. Save and copy the signing secret

Event Types

EventDescription
document.uploadedDocument upload started
document.processedDocument fully indexed
document.failedProcessing failed
document.deletedDocument removed
search.completedSearch 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

  1. Respond quickly - Return 200 within 5 seconds
  2. Process async - Queue webhooks for background processing
  3. Handle duplicates - Use event IDs for idempotency
  4. Monitor failures - Set up alerts for failed deliveries