Overview
Webhooks provide real-time notifications when document processing status changes occur. When configured, your application will receive HTTP POST requests to specified endpoints whenever documents transition through different processing states. Webhooks are essential for building responsive applications that need immediate awareness of document processing results, failures, or other status changes.Webhook Delivery
Delivery Mechanism
Webhooks are delivered via HTTP POST requests to your configured endpoint:- Method: POST
- Content-Type: application/json
- Authentication: Include
X-Webhook-Tokenheader with your webhook token - Payload: JSON:API formatted document status change event
Retry Policy
Our webhook system implements intelligent retry logic:- Initial Delivery: Immediate attempt after status change
- Max Retries: 5 attempts before marking as failed
- Dead Letter Queue: Failed deliveries are queued for manual retry
Security
Secure your endpoint
Always use HTTPS endpoints in production. HTTP is only allowed in sandbox environments.
Validate webhook tokens
Verify the
X-Webhook-Token header matches your stored webhook token. Store tokens securely - they cannot be retrieved after creation.Verifying Webhook Signatures
You can use theX-Webhook-Signature header to verify that the webhook payload was sent by Beltic. The signature is generated using an HMAC-SHA256 of the request body signed with your webhook secret.
Here is a complete example of how to verify the signature in a Node.js application:
Creating a Webhook Configuration
Prepare your endpoint
Create an HTTPS endpoint capable of receiving POST requests with JSON payloads. The endpoint should:
- Accept
application/jsoncontent type - Validate the
X-Webhook-Tokenheader - Return 2xx status codes for successful processing
- Handle duplicate deliveries gracefully
Choose subscribed statuses
Select which document status changes should trigger webhooks:
processed: Document processing completed successfullyfailed: Document processing failed
Create the webhook configuration
Use the Create Webhook Config endpoint:Important: Store the returned token securely - it cannot be retrieved again.
Listing Webhook Configurations
Retrieve all webhook configurations for your organization:Filtering Options
- Active configs only: Include
?filter[is_active]=true - Pagination: Use
page[size](default: 15, max: 100)
Managing Webhook Configurations
Retrieving a Specific Configuration
Get detailed information about a webhook config:Updating a Configuration
Modify webhook settings using the update endpoint:Deactivating a Configuration
Temporarily disable a webhook without deleting it:Webhook Payload Format
All webhook deliveries use JSON:API format:Handling Webhook Failures
Manual Resend
If a webhook was missed or needs to be re-delivered, use the resend endpoint:Testing Webhooks
Development Testing
Use tools like ngrok or localtunnel to expose local endpoints:Manual Testing
Test webhook delivery by manually resending:Best Practices
Endpoint Design
Endpoint Design
- Use HTTPS endpoints with valid SSL certificates
- Implement proper logging for webhook deliveries
- Return appropriate HTTP status codes (200 for success, 4xx/5xx for errors)
- Process webhooks asynchronously to avoid timeouts
Security
Security
- Always validate the
X-Webhook-Tokenheader - Store webhook tokens securely (environment variables, secret management)
- Implement rate limiting to protect against abuse
- Use idempotency keys to handle duplicate deliveries
Error Handling
Error Handling
- Log all webhook deliveries with timestamps and payloads
- Implement alerting for high failure rates
- Have fallback mechanisms for critical webhook-dependent features
- Monitor webhook endpoint health and performance
Configuration Management
Configuration Management
- Use different webhook URLs for different environments
- Document webhook configurations and their purposes
- Regularly review and clean up unused webhook configurations
- Test webhook configurations after deployments
Troubleshooting
Common Issues
Webhook Not Received- Check that the webhook configuration is active
- Verify the endpoint URL is accessible and returns 2xx responses
- Ensure the document status is in your subscribed statuses list
- Verify the
X-Webhook-Tokenheader is included - Confirm the token matches what was returned during configuration creation
- Check for token encoding issues
- Implement idempotency using document ID and status
- Log all received webhooks to detect duplicates
- Handle duplicate deliveries gracefully
- Process webhooks asynchronously in background jobs
- Return immediate 202 Accepted responses
- Implement proper error handling and retries in your application