Link

Create a new subscription

Webhook API endpoints allow you to create subscriptions programmatically. To create new subscriptions, you must make a POST request to the Webhook API.

POST https://webhook.apaleo.com/v1/subscriptions

With a request body like:

{
  "endpointUrl": "https://example.com",
  "topics": ["Reservation", "Folio"],
  "propertyIds": ["MUC", "BER"]
}

In the payload above, you can see how your subscription can be for multiple topics and properties. If you create the subscription without specifying a list of properties, then the subscription will automatically work for all current and future properties of the account.

Health checks

After you subscribe, apaleo sends a health-check event. If that fails, the subscription will fail and return an error. apaleo will continue pinging you every two minutes for each subscription - that way, you know that everything still works, even if no new events happened. If you use the same URL endpoint for two different subscriptions, then it will receive two health checks.

Here is a sample healthcheck payload:

{
    "id": "a5b8e2f8-16b7-4a17-93f0-c59517c46380",
    "topic": "system",
    "type": "healthcheck",
    "accountId": "DEMO",
    "propertyIds": [],
    "timestamp": 1589198420771
}

Subscription fields

A subscription object has the following fields:

  • id - A number representing the unique ID of a subscription.
  • topics - This describes what types of events this subscription is listening.
  • endpointUrl - This represents the endpoint URL.
  • created - Specifies the time when this subscription was created. This is a millisecond timestamp.
  • propertyIds - The property id (s) for which the events are subscribed. If you create the subscription without specifying a list of properties, then the subscription will automatically work for all current and future properties of the account.

Filtering mechanism for subscriptions

Two useful filtering mechanisms allow you to tailor your subscriptions to your needs. As mentioned before you can create subscriptions for a set of topics, what you can also do is to create the subscription for a group of properties or none at all.

As a requirement, your subscriptions must be for at least one topic. However, when it comes to properties, you can not provide any, and your subscription will work for all of them out of the box, think of it as your wildcard.

Here is an example of a payload to create a subscription for Reservation and Folio topics for a set of properties:

{
  "endpointUrl": "https://example.com",
  "topics": ["Reservation", "Folio"],
  "propertyIds": ["MUC", "BER"]
}

Using the same payload above, however, without the properties filter:

{
  "endpointUrl": "https://example.com",
  "topics": [
    "Reservation",
    "Folio"
  ]
}