Prerequisites
- Node.js 18+
- A web framework (Next.js, Express, Fastify, etc.)
- A publicly accessible URL (or ngrok for local development)
- Your webhook signing secret from the Doclo dashboard
How Webhooks Work
- Your app starts an async execution with a
webhookUrl - Doclo processes the document
- When complete, Doclo sends an HTTP POST to your webhook URL
- Your handler verifies the signature and processes the result
Webhook Payload
Doclo sends a JSON payload with this structure:Signature Verification
Every webhook includes a signature header for authentication. Always verify signatures in production.Header Format
SDK Verification
The easiest way to verify signatures:Manual Verification
If you need to verify without the SDK:Next.js Handler
Express Handler
Fastify Handler
Database Integration
Save extraction results to your database:Idempotent Processing
Webhooks may be delivered multiple times. Ensure your handler is idempotent:Retry Behavior
Doclo retries failed webhook deliveries automatically:
A delivery is considered failed if:
- Your server returns a non-2xx status code
- Connection times out (30 seconds)
- Connection cannot be established
Async Processing Pattern
For complex processing, acknowledge immediately and process async:Local Development
Use ngrok to expose your local server:Security Best Practices
- Always verify signatures - Never process unverified webhooks
- Use HTTPS - Ensure your endpoint uses TLS
- Validate timestamps - Reject old webhooks to prevent replay attacks
- Store secrets securely - Use environment variables, never commit secrets
- Log cautiously - Don’t log sensitive data from webhook payloads
- Rate limit - Protect against abuse even with signature verification
Monitoring and Alerting
Track webhook health:- High webhook failure rates
- Long processing times
- Missing webhooks (executions completing without webhook delivery)
- Signature verification failures (possible security issues)
Get Your Webhook Secret
- Log in to app.doclo.ai
- Navigate to Settings > Webhooks
- Copy your webhook signing secret
- Store it as
DOCLO_WEBHOOK_SECRETin your environment
Next Steps
Webhooks
Webhook configuration reference
Next.js Integration
Complete Next.js example
Error Recovery
Handle failures gracefully
Polling Results
Alternative to webhooks