---
updatedAt: 2025-09-05T20:49:20.000Z
agentTools:
  projectIndex: https://developers.facilioo.de/llms.txt
---

# Webhooks

```python Python
import requests

baseUrl = "https://api.facilioo.de/api"
headers = {
  "accept": "application/json",
  "content-type": "application/*+json",
  "authorization": "Bearer <access-token>"
}
  
# Show webhook registrations
url = baseUrl + "/webhook-registrations"
response = requests.get(url, headers=headers)
print(response.json())

# Define the events to be notified for
enabledEvents = [
    {
      "type": 1,
      "entityName": "Property"
    }
]

# Configure the authroization required for your callback endpoint
targetAuthorization = {
    "authorizationType": 0  # no authorization
}

# Create a wehook registration
url = baseUrl + "/webhook-registrations"
body = {
  "partyId": "<partyId>",
  "targetUrl": "<targetUrl>",
  "enabledEvents": enabledEvents,
  "shouldGroup": True,
  "shouldGroupContinueAfterFail": True,
  "targetAuthorization": targetAuthorization
}
response = requests.post(url, headers=headers, json=body)

# Trigger a webhook
url = baseUrl + "/properties"
body = {
  "tenantId": "<tenantId>",
  "number": "WEG 1",
  "name": "Ku'damm 92",
  "fullStreet": "Kurfürstendamm 92",
  "zipCode": "10709",
  "city": "Berlin"
}
response = requests.post(url, headers=headers, json=body)

# Show webhooks
url = baseUrl + "/webhooks"
response = requests.get(url, headers=headers)
print(response.json())

# Show webhook attempts
url = baseUrl + "/webhook-attempts"
response = requests.get(url, headers=headers)
print(response.json())

```

```json Response Example
{"success":true}
```

# Initialize

<!-- python@1-9 -->

Set the proper `baseUrl` to target the designated enviornment.

Insert your `accessToken` obtained via the auth flow.

Also, be sure to check out or reference documentation for webhooks: https://developers.facilioo.de/reference/webhooks.

# Show Existing Webhook Registrations

<!-- python@9-14 -->

Facilioo implements Webhooks. This means, it can make automated calls to a target url, whenever certain events occur inside the facilioo system. 

Possible events are: an entity is `created`, `updated` or `deleted`. 

To set up such an automated call on a certain event, a `WebhookRegistration` has to be created. 

You can see all of your existing `WebhookRegistrations` by calling `GET /api/webhook-registrations`.

# Create A Webhook Event

<!-- python@14-22 -->

A `WebhookRegistration` has one or multiple enabled `WebhookEvents`. A `WebhookEvent` captures a specific change that can occur in a specific entity. 

In order to create a `WebhookRegistration`, a `WebhookEvent` will be defined. It needs the name of the entity that will be tracked as a `string` (`entityName`) and the kind of change that will be tracked as an `integer` (`webhookEventType` with `1=Created`, `2=Updated` and `3=Deleted`).

# Create Webhook Target Authorization

<!-- python@22-27 -->

The Webhook will be sent to an endpoint that potentially needs a form of authentication. The credentials that can be used by facilioo to authenticate to the target can be set up by creating a `WebhookTargetAuthorization` entity. 

At the moment, only `NoAuth` (`0`) and `BasicAuth` (`1`) are supported. For the latter one, a `username` and `password` needs to be provided.

# Create Webhook Registration

<!-- python@27-39 -->

With this, a `WebhookRegistration` can be created. It needs a `propertyManagementCompanyId` (the `id` of your `Party`), a `targetUrl` (the endpoint that will be called by the webhook). An array of `enabledEvents`, the `targetAuthorization` and the boolean attributes `shouldGroup` and `shouldGroupContinueAfterFail`. 

There are entities for which it can be important, that webhooks on changes are sent in a certain order to avoid race conditions. For example, a `Topic` always belongs to a `Conference` and is therefore always created after the `Conference`. It might be important, that the webhook of the `Topic Creation` waits for the `Conference Creation` webhook to arrive. In the background, facilioo stores a list of which entities have dependencies on each other by assigning them to “messageGroups”.  If `shouldGroup` is set to `true`, then the webhooks of this `WebhookRegistration` are sent in consecutive order for entities that are in the same `messageGroup`. If additionally `shouldGroupContinueAfterFail` is set to `true`, then in case a webhook is waiting on a previous one that failed, it stops waiting and is executed instead. “Failing” means it either could not be sent after retrying 6 times or it was manually aborted.

In this example, a `WebhookRegistration` is created that is triggered when a new `Property` is created.

# Trigger a webhook

<!-- python@39-51 -->

To trigger a webhook for the just created `WebhookRegistration` a `Property` must be created. 

(Please insert a `tenantId` here that is available in your context. See `/api/tenants`)

# Show Webhooks

<!-- python@51-56 -->

The `Webhook` entity captures an execution of an existing `WebhookRegistration`. Whenever one of the specified events occurs, a `Webhook` entity is instantiated. It holds the `webhookRegistrationId` (the id of the `WebhookRegistration` it belongs to), an `eventId` (the id of the concrete `WebhookEvent` that occured), an `entityId` (the id of the entity that changed), a `messageGroupId` (which is the id of the before mentioned `messageGroup`), an `entityJson` (which holds the new attributes and values of the entity that changed) and a `state`. The state can be `1-Created` (right after the `Webhook` was created), `2-Retrying` (when the delivery failed at least once and but it will try again later), `3-Successful` (when the webhook was delivered successfully), `4-Failed` (when the webhook was not delivered after 6 retries), `5-Aborted` (when the webhook was manually stopped), `6-Pending` (when the webhook is waiting on another preceeding one in the same `messageGroup`), `7-Resolved` (when a failed webhook was manually fixed).
You can see your `Webhook` entities by calling `GET /api/webhooks`. Because the previously created `WebhookRegistration` was triggered, there should exist a webhook for it now.

# Show Webhook Attempts

<!-- python@56-61 -->

Like mentioned before, when a webhook execution failed, it will be executed again up to 6 times. Each single execution attempt is saved as a `WebhookAttempt` entity. It holds a `webhookId` (which is the id of the `Webhook` entity it belongs to), a `responseHttpStatusCode` and `responseBody` (the status code and body of the response from the target after the execution), a `tryCount` (the number of the current try for sending the webhook) and a `scheduledAt` field. Once the first attempt failed, the following attempts are not executed right away but are scheduled by the following rules: The 2nd try will be executed after 5min, the 3rd after another 15min, the 4th after another 1h, the 5th after another 6h, the 6th after another 12h and the last after another 24h. The time in UTC at which the `WebhookAttempt` is scheduled is saved in the `scheduledAt` field.
You can see your `WebhookAttempt` entities by calling `GET /api/webhook-attempts`. There should exist a `WebhookAttempt` for the new `Webhook` now.