v4/Architecture

Event Lifecycle & Status Tracking

Every booking event — whether from Mosler Direct or a PMS integration — is persisted and transitions through a well-defined set of statuses. You can poll these statuses to confirm a booking was processed, without relying on any callback.


Status states

StatusMeaning
RECEIVEDEvent accepted by the webhook service; not yet queued. Transient — normally advances to QUEUED within milliseconds.
QUEUEDPublished to the queue. The worker will pick it up shortly.
PROCESSINGWorker has dequeued the event and is executing business logic.
COMPLETEDBooking created/updated/cancelled and device access provisioned successfully.
FAILEDProcessing failed after all retries. See message for the reason.
DEAD_LETTERPermanently failed after 3 retry attempts. Requires manual intervention.
DUPLICATEIdentical event (same referenceId + action within 60 s) was already received. Stored for audit; not reprocessed.

Lifecycle flow

Event received
        │
        ▼
  RECEIVED ──────── queue publish fails ──────► FAILED
        │                                          │
        │ publish OK                     (retry 1, 2, 3)
        ▼                                  3rd fail ▼
     QUEUED                            DEAD_LETTER
        │
        │ Worker picks up
        ▼
  PROCESSING
        │
        ├─── Success ──────────────────────► COMPLETED
        │
        └─── Error → retry (up to 3) ──────► DEAD_LETTER

Retry behaviour

The worker uses the queue's dead-letter exchange for automatic retries. On a processing error, the message is re-queued with an incrementing retry_count. After 3 failed attempts, the event moves permanently to DEAD_LETTER and is removed from the active queue. Failed events can also be manually retried via the admin endpoint (below).


Get event status

Poll an event by the eventId returned in the webhook response.

GET https://webhook.mosler.in/webhook/events/:eventId

curl https://webhook.mosler.in/webhook/events/a3f9d2e1-84c7-4b56-9f13-0d2e4c8a1b7f \
  -H "apikey: YOUR_MOSLER_API_KEY"
{
    "success": true,
    "eventId": "a3f9d2e1-84c7-4b56-9f13-0d2e4c8a1b7f",
    "status": "COMPLETED",
    "message": null
}
FieldTypeDescription
successbooleanfalse if the event ID was not found
eventIdstringThe event identifier
statusstringCurrent lifecycle status
messagestring | nullError message if status is FAILED or DEAD_LETTER; otherwise null

Get events by reference ID

Retrieve every event for a booking reference — useful for auditing a reservation's history.

GET https://webhook.mosler.in/webhook/events/reference/:referenceId

{
    "success": true,
    "count": 2,
    "events": [
        {
            "event_id": "a3f9d2e1-84c7-4b56-9f13-0d2e4c8a1b7f",
            "event_type": "BOOKING_CREATE",
            "status": "COMPLETED",
            "reference_id": "RES-20250718-001",
            "received_at": "2025-07-18T09:12:44.000Z",
            "updated_at": "2025-07-18T09:12:46.812Z"
        },
        {
            "event_id": "b4e8c3f2-95d8-5c67-a024-1e3f5d9b2c8g",
            "event_type": "BOOKING_CANCEL",
            "status": "COMPLETED",
            "reference_id": "RES-20250718-001",
            "received_at": "2025-07-19T14:33:11.000Z",
            "updated_at": "2025-07-19T14:33:12.441Z"
        }
    ]
}

List events (paginated)

GET https://webhook.mosler.in/webhook/events

Results are always scoped to the company of the authenticated apikey — there is no cross-company access.

ParameterTypeDescription
pagenumberPage number (default: 1)
pageSizenumberResults per page (default: 20, max: 100)
statusstringFilter by lifecycle status
referenceIdstringFilter by booking reference ID
{
    "success": true,
    "events": [],
    "pagination": { "page": 1, "pageSize": 50, "total": 3, "totalPages": 1 }
}

Retry failed events (admin)

Manually re-queue all events currently in FAILED status.

POST https://webhook.mosler.in/webhook/retry

{
    "success": true,
    "retried": 2,
    "failed": 1
}
FieldDescription
retriedEvents successfully re-queued
failedEvents that failed again (approaching DEAD_LETTER)