| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Lines of code | 2182 |
| Technical Name |
odoo_webhook_engine |
| License | LGPL-3 |
| Website | http://auraodoo.tech/ |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
Discuss (mail)
|
| Lines of code | 2182 |
| Technical Name |
odoo_webhook_engine |
| License | LGPL-3 |
| Website | http://auraodoo.tech/ |
Odoo Webhook Engine
Enterprise-Grade Event-Driven Integration Framework for Odoo
Overview
The Odoo Webhook Engine is a comprehensive event-driven integration framework that enables real-time communication between Odoo and external systems. It provides a robust infrastructure for triggering webhooks on model events, managing payload transformations, handling retries, and maintaining detailed audit logs for all webhook operations.
Key Features
Event-Driven Webhook Rules
Create flexible webhook rules that trigger on create, write, unlink, and custom model events. Filter by field changes and conditions.
Real-Time Event Dispatching
Dispatch webhooks synchronously or asynchronously with configurable retry policies, exponential backoff, and dead-letter queue handling.
Advanced Payload Building
Dynamically construct webhook payloads with field selection, transformations, computed values, nested relations, and custom hooks.
Request Signature Verification
HMAC-SHA256 signature generation and verification for webhook authenticity. Secure payload delivery with cryptographic verification.
Comprehensive Webhook Logging
Full audit trail of webhook requests, responses, execution times, status codes, and error details for troubleshooting.
Incoming Webhook Support
Receive and process webhooks from external systems with signature verification, payload parsing, and custom action handlers.
Intelligent Retry Mechanism
Automatic retry queue with exponential backoff, configurable intervals, and dead-letter queue for permanently failed webhooks.
Analytics Dashboard
Real-time webhook analytics showing success rates, endpoint performance, daily traffic, event distribution, and error tracking.
Module Statistics
8
Core Models
3
Service Modules
2
Controllers
6
View Types
Core Data Models
Webhook Rule (webhook.rule)
Defines event-triggered webhook configurations and routing.
- • Name and Description
- • Model Selection (which model triggers the webhook)
- • Event Triggers (create, write, unlink, custom events)
- • Target Webhook URL
- • Payload Configuration and Field Selection
- • Authentication Method (Basic Auth, Bearer Token, API Key)
- • HTTP Method (GET, POST, PUT, PATCH, DELETE)
- • Custom Headers Support
- • Active/Inactive Status
- • Test Mode for Development
Webhook Log (webhook.log)
Comprehensive audit trail for all webhook dispatches.
- • Rule Reference and Name
- • Model and Record Information
- • Event Code
- • Target URL and HTTP Method
- • Request Headers and Payload
- • Response Status Code and Body
- • Response Headers
- • Execution Time (milliseconds)
- • Status (success, failed, pending, test)
- • Error Messages
- • Retry Information
Webhook Retry (webhook.retry)
Dead-letter queue and retry management for failed webhooks.
- • Reference to Failed Log Entry
- • Retry State (pending, retrying, exhausted, succeeded)
- • Attempt Count and Maximum Retries
- • Next Retry Schedule
- • Exponential Backoff Configuration
- • Last Error Message
- • Manual Retry Action
Webhook Event (webhook.event)
Event configuration and mapping for custom triggers.
- • Event Code (create, write, unlink, custom)
- • Model Mapping
- • Event Description
- • Standard vs Custom Events
- • Active Status
Webhook Payload Field (webhook.payload.field)
Field-level payload configuration for dynamic payload building.
- • Field Name Selection
- • Field Type (char, integer, float, date, datetime, etc.)
- • Custom Field Name in Payload
- • Include in Payload Toggle
- • Transformation Functions
- • Default Values
IR Model Hook (ir.model.hook)
Model-level event hook configuration.
- • Model Reference
- • Event Type Mapping
- • Hook Active Status
Webhook Incoming (webhook.incoming)
Receive and process inbound webhooks from external systems.
- • Webhook Payload Storage
- • Source Identification
- • Signature Verification Status
- • Processing State
- • Custom Action Handlers
- • Error Tracking
Webhook Event History
Event tracking and analytics data.
- • Event Timestamp
- • Model and Record Reference
- • Event Type
- • Triggered Rules Count
- • Success/Failure Statistics
Service Architecture
The webhook engine uses a modular service-oriented architecture with three primary components:
| Service | Responsibility | Key Functions |
|---|---|---|
| Dispatcher | Main event dispatcher and webhook execution engine | dispatch_event(), retry_single(), async_dispatch(), handle_event() |
| Payload Builder | Dynamic payload construction and field transformation | build_payload(), apply_transformations(), nest_relations(), compute_fields() |
| Signature Manager | HMAC-SHA256 signature generation and verification | generate_signature(), verify_signature(), secret_key_management() |
Controllers and API Endpoints
Incoming Webhook Controller
Receives and processes inbound webhooks from external systems
- • POST /webhook/incoming - Receive webhook payload
- • Signature verification for authenticity
- • Payload parsing and validation
- • Custom event handler routing
- • Error handling and logging
Dashboard Controller
Provides webhook analytics and monitoring data
- • GET /webhook/dashboard/data - Retrieve dashboard metrics
- • Summary statistics (total_sent, success_count, failed_count)
- • Top endpoints performance data
- • Events per model breakdown
- • Daily traffic statistics
- • Event type distribution
Data Files and Configuration
Webhook Event Data (webhook_event_data.xml)
Provides default event configurations on module installation:
- • Standard event types (create, write, unlink)
- • Common models mapping
- • Pre-configured event templates
Scheduled Jobs (cron.xml)
Automated webhook maintenance and cleanup tasks:
- • Hourly retry job for failed webhooks
- • Daily log cleanup (old success logs)
- • Dead-letter queue processing
- • Performance metrics computation
User Interface Components
Webhook Operations and Flow
Outbound Webhook Flow
- 1. Model event triggered (create, write, unlink)
- 2. Dispatcher finds matching webhook rules
- 3. Payload builder constructs JSON payload with selected fields
- 4. Signature manager generates HMAC-SHA256 signature
- 5. HTTP request sent to target URL with headers
- 6. Response status and body captured
- 7. Execution logged with metrics
- 8. Failed webhooks added to retry queue with backoff
Inbound Webhook Flow
- 1. External system sends POST to /webhook/incoming
- 2. Signature verification against stored secret
- 3. Payload validation and parsing
- 4. Custom event handler routing
- 5. Record creation or update in Odoo
- 6. Response sent back to caller
- 7. Full transaction logged
Security and Signature Verification
HMAC-SHA256 Implementation
- • Shared secret key generation and storage
- • Signature computed on request body with secret
- • X-Webhook-Signature header included in requests
- • Receiver verifies signature before processing
- • Timestamp-based replay attack prevention
Authentication Methods
- • Basic Authentication (base64 encoded credentials)
- • Bearer Token (OAuth or custom tokens)
- • API Key (custom header or parameter)
- • HMAC Signature verification
- • Custom header support
Retry Strategy and Error Handling
Exponential Backoff Configuration
- • Initial retry delay: 60 seconds
- • Backoff multiplier: 2x per attempt
- • Maximum retry interval: 24 hours
- • Maximum retry attempts: 10 (configurable)
- • Jitter to prevent thundering herd
Error Categories and Handling
- • Network errors: Automatic retry
- • Timeout errors: Queue for retry
- • 5xx server errors: Retry with backoff
- • 4xx client errors: Log without retry
- • Connection refused: Queue for retry
Advanced Payload Building
Payload Features
- • Field-level selection and filtering
- • Custom field naming in payload
- • Data type transformations
- • Nested relation expansion
- • Computed field injection
- • Default values for missing fields
- • Custom transformation hooks
Payload Structure
- • Event metadata headers
- • Record data with selected fields
- • Before/after values for write events
- • User and timestamp information
- • Custom business logic data
Requirements
- • requests (HTTP client library)
- • cryptography (HMAC-SHA256 signing)
- • Standard library: json, logging, datetime, hashlib, hmac
- • Odoo server with background job support
- • Network connectivity to target webhook endpoints
- • Sufficient disk space for webhook logs
Getting Started
- Install the Odoo Webhook Engine module from your add-ons directory
- Navigate to Webhooks > Configuration > Webhook Rules
- Click Create to define a new webhook rule
- Select the model you want to monitor (e.g., Sale Order)
- Choose event triggers (create, write, unlink)
- Enter the target webhook URL
- Configure authentication method and headers
- Select fields to include in the payload
- Test the webhook with test mode
- Monitor webhook activity via the analytics dashboard
API and Integration Points
The webhook engine exposes multiple integration points for customization and automation:
- • Dispatcher API: dispatch_event(), retry_single(), async_dispatch()
- • Event Hooks: _trigger_webhook_event(), custom event handlers
- • Payload Builders: Custom field transformations, nested data expansion
- • Webhook Endpoints: /webhook/incoming, /webhook/dashboard/data
- • Signature Verification: verify_incoming_webhook_signature()
- • Analytics: get_dashboard_data() for custom dashboard builds
- • Cron Jobs: Extensible retry and cleanup schedules
Troubleshooting
Webhooks Not Triggering
Verify rule is active, model event filter is correct, check webhook logs for any errors, ensure target URL is reachable, review network firewall settings.
Signature Verification Failures
Confirm shared secret matches between sender and receiver, check timestamp hasn't expired, verify payload encoding, review signature algorithm compatibility.
Failed Webhook Retries
Review retry queue status, check target endpoint availability, verify network connectivity, adjust retry configuration, manually retry from dead-letter queue.
High Latency in Webhook Dispatch
Enable asynchronous dispatch mode, optimize payload size, reduce field selections, monitor target endpoint response time, configure appropriate timeouts.
Memory or Storage Issues
Enable log cleanup cron job, reduce log retention period, archive old logs, optimize webhook payload size, monitor database disk space.
Best Practices
Webhook Rule Design
- • Use specific event filters to reduce false triggers
- • Select only required fields in payload to reduce data transfer
- • Implement idempotency on receiver side for failed retries
- • Use test mode during development
- • Set appropriate timeouts for target endpoints
Security Practices
- • Always verify webhook signatures before processing
- • Use HTTPS for all webhook URLs
- • Rotate secret keys periodically
- • Restrict webhook access with firewall rules
- • Log all webhook operations for audit trails
Performance Optimization
- • Use async dispatch for non-critical operations
- • Configure appropriate retry intervals
- • Monitor webhook performance metrics
- • Archive old logs regularly
- • Optimize target endpoint response times
Common Use Cases
E-Commerce Order Integration
Automatically sync Odoo sales orders to fulfillment systems, shipping providers, or accounting platforms on order creation and update.
Inventory Synchronization
Push real-time stock level updates to external marketplaces, warehouses, or third-party inventory management systems.
Customer Data Sync
Synchronize customer records to CRM systems, email marketing platforms, or data warehouses when created or modified in Odoo.
Payment Processing
Trigger payment processing in external payment gateways or accounting systems based on invoice creation or payment status changes.
Notification Systems
Send real-time notifications to Slack, Teams, email systems, or SMS services based on critical business events in Odoo.
Odoo Webhook Engine - Version 1.0.0
Enterprise-Grade Event-Driven Integration Framework | Secure Real-Time Webhooks for Odoo
Please log in to comment on this module