Webhooks¶
Webhooks allow your external application (e.g. a Next.js site) to notify Odoo of events: booking modifications, calendar synchronization, etc.
Webhook Authentication¶
Unlike API v1 endpoints (Bearer Token), webhooks use an HMAC-SHA256 signature:
X-Odoo-Signature: sha256=your_hmac_signature
Generate the Signature¶
import crypto from 'crypto';
function generateWebhookSignature(payload, secret) {
return 'sha256=' + crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
}
Configure the Secret¶
In Odoo: AirDoo → Configuration → Settings → Webhook Settings → Generate Webhook Secret
Secret not configured
If the webhook secret is not configured in Odoo, signature validation is disabled. Always configure it in production.
POST /airdoo/webhook/update¶
Notifies Odoo of a booking modification or cancellation.
Request Body¶
{
"event_type": "booking_updated",
"booking_id": 456,
"new_data": {
"checkin_date": "2026-06-16",
"checkout_date": "2026-06-22",
"guest_count": 3,
"notes": "Guest requested date change"
},
"reason": "Date change requested by guest",
"timestamp": "2026-03-15T15:00:00Z"
}
| Parameter | Type | Required | Description |
|---|---|---|---|
event_type |
string | ✅ | booking_updated, cancelled, modified |
booking_id |
integer | ✅ | Odoo booking ID |
new_data |
object | ❌ | New values to apply |
reason |
string | ❌ | Reason for modification |
timestamp |
string ISO 8601 | ❌ | Timestamp |
Response¶
{
"success": true,
"updated": true,
"message": "Booking updated",
"booking_id": 456,
"new_status": "modified"
}
POST /airdoo/webhook/calendar_sync¶
Forces a calendar synchronization for an accommodation.
Request Body¶
{
"accommodation_id": 1,
"action": "sync",
"timestamp": "2026-03-15T15:00:00Z"
}
GET /airdoo/webhook/test¶
Public test endpoint to verify accessibility.
curl -X GET "https://your-odoo.com/airdoo/webhook/test"
Sending a Webhook to Odoo (Next.js)¶
// lib/webhooks.ts
import crypto from 'crypto';
export async function notifyOdooBookingUpdate(
bookingId: number,
newData: Record<string, unknown>,
reason: string
) {
const payload = JSON.stringify({
event_type: 'booking_updated',
booking_id: bookingId,
new_data: newData,
reason,
timestamp: new Date().toISOString(),
});
const signature = 'sha256=' + crypto
.createHmac('sha256', process.env.AIRDOO_WEBHOOK_SECRET!)
.update(payload)
.digest('hex');
const response = await fetch(
`${process.env.AIRDOO_API_URL}/airdoo/webhook/update`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Odoo-Signature': signature,
},
body: payload,
}
);
return response.json();
}
← Back: Booking API | Next: Next.js Integration →