Skip to main content

Webhooks

Subscribe to booking webhooks to receive terminal-state events without polling.

Registering a webhook​

POST /api/v1/FlightBooking/Webhooks:

{
"url": "https://your-server.example.com/webhooks/ondgo",
"events": ["flight_booking.completed", "flight_booking.failed"]
}
  • url must use HTTPS and resolve to a public address.
  • events defaults to both event types if omitted.
  • The response includes a signing secret, returned once, at creation. Store it securely — it isn't shown again.

Event types​

EventFired when
flight_booking.completedA booking attempt reaches Completed.
flight_booking.failedA booking attempt reaches Failed.

Verifying a delivery​

Every delivery includes three headers:

X-Ondgo-Event-Id: <unique id for this delivery>
X-Ondgo-Timestamp: <unix timestamp, seconds>
X-Ondgo-Signature: sha256=<hex-encoded HMAC-SHA256>

The signature is computed over {timestamp}.{eventId}.{payload} (the raw request body, dot-joined with the two header values above), using your webhook's own signing secret:

import hashlib
import hmac

def verify(secret: str, timestamp: str, event_id: str, payload: str, signature_header: str) -> bool:
expected = hmac.new(
secret.encode(),
f"{timestamp}.{event_id}.{payload}".encode(),
hashlib.sha256,
).hexdigest()
return hmac.compare_digest(f"sha256={expected}", signature_header)

Reject any delivery whose signature doesn't match — this confirms the payload actually came from OnDgo and wasn't tampered with in transit.

Delivery retries​

A failed delivery is retried automatically. Deduplicate events with X-Ondgo-Event-Id.

Managing webhooks​

  • GET /api/v1/FlightBooking/Webhooks — list your registered webhooks.
  • GET /api/v1/FlightBooking/Webhooks/{id} — get one.
  • PUT /api/v1/FlightBooking/Webhooks/{id} — update the URL, events, or secret.
  • DELETE /api/v1/FlightBooking/Webhooks/{id} — remove one.

Full request/response shapes are in the API Reference.