Usage Guide

Webhooks allow Hostex OpenAPI users to receive real-time data pushes when specific events occur. This guide will assist you in setting up and utilizing OpenAPI Webhooks for the following event types:

  • reservation_created
  • reservation_updated
  • property_availability_updated
  • listing_calendar_updated
  • message_created
  • review_created
  • review_updated
  • reservation_cancelled
  • guest_review_created
  • transaction_created
  • transaction_updated
  • transaction_deleted

Understanding Webhooks

Webhooks are a method by which an application can automatically send information to another application in response to certain events. When an event is triggered, OpenAPI sends an HTTP POST request to your specified URL, containing information about the event.

Setting Up Webhooks

To begin using OpenAPI Webhooks, you need to configure them in the OpenAPI developer console.

  1. Log in to the OpenAPI Setting Page.
  2. Navigate to the Webhooks settings tab.
  3. Click on the "+ Add new" button.
  4. Enter the URL where you want to receive Webhook notifications.

Webhook quotas

Manual webhooks, webhooks created with a self-service access token, and legacy webhooks share the account-owned quota. Creation is limited to 3 through the web portal or 5 through v3 with a self-service access token.

Each OAuth application has a separate quota for each account: 50 webhooks by default. Application webhooks do not consume the account-owned quota or another application's quota. Contact Hostex if you need an account-specific limit. Lowering a limit leaves existing webhooks delivering normally but prevents new creation while the quota is full.

API-created webhooks and disconnection

POST /webhooks returns data.id and data.secret_token once, in the creation response. Save the secret securely and compare incoming Hostex-Webhook-Secret-Token headers against it. Query and update endpoints never return it; if lost, delete and recreate the webhook. Each webhook record has its own secret, which changes when it is recreated.

Call GET /accounts/me after authorization to save the stable string account_id. Main-account and sub-account authorizations share that ID. For ordinary business events, map each configured webhook endpoint to its saved account ID.

When the host disconnects your application in Hostex, or your application revokes its OAuth connection, Hostex deletes webhooks created through the API by your application for that account. Manual webhooks, legacy records without an application ownership marker, and other applications' webhooks are retained. For public OAuth clients and platform applications that support multiple connections, revoking one token does not disconnect the application or delete its webhooks while another token remains; revoking the last token does. Host-initiated application disconnection revokes all its tokens.

This lifecycle event is automatic and is not a selectable value in the events filter. A final authorization_revoked event is sent to each deleted webhook's saved URL using its original secret, even if its business-event filter excludes this event. The payload includes account_id, client_id, a ULID string event_id and UTC timestamp. No notification can be sent if your application has no owned webhook. Existing queued business events are skipped once the webhook is removed. Requests already in flight cannot be recalled and may arrive after the final notification; treat your local connection as revoked and ignore subsequent business events until reauthorization.

This notification uses the same timeout, immediate transport retries and circuit breaker described below. It is best effort, with no delayed replay or guaranteed delivery. Its event_id stays the same for retries; process it idempotently. Connection revocation and webhook deletion take effect even if notification delivery fails. After reconnecting, create new webhooks and save their new secrets.

Event Types

Here are the types of events you can subscribe to and their meanings:

EventDescrition
reservation_createdTriggered when a new reservation is made.
reservation_updatedTriggered when an existing reservation is updated.
property_availability_updatedTriggered when the availability of a property changes.
listing_calendar_updatedTriggered when a listing's calendar is updated.
message_createdTriggered when a new message is created.
review_createdTriggered when a review is created.
review_updatedTriggered when a review is updated.
reservation_cancelledTriggered once when a reservation becomes cancelled.
guest_review_createdTriggered once when a guest's review first appears.
transaction_createdTriggered when an income or expense entry is created.
transaction_updatedTriggered when an income or expense entry is updated.
transaction_deletedTriggered when an income or expense entry is deleted.

🚧

We are constantly improving our API which could mean that webhook payloads may change. In order to maintain a healthy integration, your Application must parse and ignore unexpected parameters instead of rejecting the notification

Receiving and Processing Webhooks

Your Webhook URL should point to an endpoint of a web service that is set up to parse the data from the HTTP POST request and take appropriate action.

Security Considerations

When your service receives a webhook request, it will include a Hostex-Webhook-Secret-Token in the request headers. This token is unique to each webhook record and remains constant until that record is deleted. It is imperative to record this token and verify its consistency with each incoming request to confirm the authenticity of the request.

⚠️

Important Security Note: Do not share the Hostex-Webhook-Secret-Token with others. Exposing this token could result in security risks. Always keep it confidential and use it solely for validation purposes.

Timeout Handling

Each notification is sent to your URL as an HTTP POST. Hostex waits up to 3 seconds to connect to your endpoint and up to 5 seconds in total for the response.

  • Transport failures are retried immediately. If the request cannot be completed — the connection is refused or times out, DNS or TLS fails, or no response arrives within 5 seconds — Hostex retries right away, with no delay between attempts. A notification gets at most 3 attempts in total.
  • Any attempt, including the first, may come from a different IP address. Do not accept webhooks only from a single allow-listed IP; authenticate requests with Hostex-Webhook-Secret-Token as described above.
  • An HTTP response counts as delivered, and an error status does not cause a retry. The exception is 404 and 410: they are not retried either, but they are treated as "this endpoint no longer exists" and count as a failed delivery (see "Endpoints that keep failing are paused" below). Every other status, including 401, 403, 429 and 5xx, counts as delivered. For application-created webhooks, a 410 Gone response to a business event also deletes the webhook by default; create a new webhook to resume delivery. Manual and legacy webhooks are retained, and 404 never triggers deletion.
  • Configure the final HTTPS URL. Hostex follows redirects, but a 301, 302 or 303 redirect turns the request into a GET without a body, and whatever the redirect target answers still counts as delivered.
  • There is no delayed redelivery. If every attempt fails, the notification is dropped. It is not queued for later and cannot be replayed.
  • Endpoints that keep failing are paused. When deliveries to the same URL keep failing — every attempt gets no response, or the response is 404 or 410 — Hostex stops sending to it for a while. Notifications that occur during the pause are dropped, not sent later. If the URL is still in use, do not answer 404 or 410 to mean "I don't handle this notification"; answer with a 2xx instead.
  • The same notification can arrive more than once. For example, if your endpoint handles a request but answers after the 5-second limit, the retry delivers it again.

To stay in sync:

  • Answer with a 2xx status as soon as the request is received, and do any slow work asynchronously (for example in your own queue).
  • Make processing idempotent using event_id. Every v3 notification includes a 26-character ULID string. All webhook URLs for the same event and all retries share the same ID; distinct emitted events have different IDs. Store processed IDs and skip duplicates. The ID does not guarantee delivery or ordering, and does not identify the affected resource or originating API request.
  • Do not rely on webhooks alone. Periodically reconcile by reading the current state through the API — for example GET /reservations, GET /conversations, GET /reviews, GET /availabilities or POST /listings/calendar — to pick up anything that was not delivered.

Example: Node.js Express Webhook Endpoint Handler

const express = require('express');
const bodyParser = require('body-parser');

const app = express();
app.use(bodyParser.json());

app.post('/webhook-endpoint', (req, res) => {
    const eventType = req.body.event;

    switch(eventType) {
        case 'reservation_created':
            // Handle reservation creation
            break;
        case 'reservation_updated':
            // Handle reservation update
            break;
        case 'property_availability_updated':
            // Handle property availability update
            break;
        case 'listing_calendar_updated':
            // Handle listing calendar update
            break;
        case 'message_created':
            // Handle message creation
            break;
        case 'review_created':
            // Handle review creation
            break;
        case 'review_updated':
            // Handle review update
            break;
        default:
            // Handle unknown event type
    }

    // Confirm receipt
    res.status(200).send('Event received');
});

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
    console.log(`Server is listening on port ${PORT}`);
});

Summary

By setting up and properly handling Webhooks, you can ensure your application responds promptly to event notifications from OpenAPI. Remember to appropriately process each event type within your application, to acknowledge each request with a 2xx status well within the 5-second limit, and to reconcile periodically through the API, because notifications that fail to be delivered are not sent again.